flake: factor out some machine helpers
new structure is `imgs.<foo>` to build a disk image
This commit is contained in:
131
flake.nix
131
flake.nix
@@ -34,75 +34,69 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, pkgs-gitea, pkgs-mobile, mobile-nixos, home-manager, nurpkgs }: {
|
outputs = { self, nixpkgs, pkgs-gitea, pkgs-mobile, mobile-nixos, home-manager, nurpkgs }: {
|
||||||
nixosConfigurations.uninsane = self.decl-machine {
|
machines.uninsane = self.decl-bootable-machine { name = "uninsane"; system = "aarch64-linux"; };
|
||||||
system = "aarch64-linux";
|
machines.desko = self.decl-bootable-machine { name = "desko"; system = "x86_64-linux"; };
|
||||||
extraModules = [ ./machines/uninsane ];
|
machines.lappy = self.decl-bootable-machine { name = "lappy"; system = "x86_64-linux"; };
|
||||||
};
|
|
||||||
packages.aarch64-linux.uninsane-img = self.decl-img {
|
machines.pda = {
|
||||||
system = "aarch64-linux";
|
nixosConfigurations.pda = pkgs-mobile.lib.nixosSystem {
|
||||||
extraModules = [ ./machines/uninsane ];
|
# inherit (self.genpkgs.aarch64-linux) pkgs;
|
||||||
|
system = "aarch64-linux";
|
||||||
|
modules = [
|
||||||
|
mobile-nixos.nixosModules.pine64-pinephone ({
|
||||||
|
users.users.root.password = "147147";
|
||||||
|
})
|
||||||
|
({ pkgs, ... }: {
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "21.11"; # Did you read the comment?
|
||||||
|
})
|
||||||
|
# ({ pkgs, mobile-nixos, ... }: {
|
||||||
|
# imports = [
|
||||||
|
# (import "${mobile-nixos}/lib/configuration.nix" { device = "pine64-pinephone"; })
|
||||||
|
# ];
|
||||||
|
# })
|
||||||
|
# ({ pkgs, ... }: {
|
||||||
|
# imports = [
|
||||||
|
# <mobnixos>/devices/pine64-pinephone
|
||||||
|
# ];
|
||||||
|
# })
|
||||||
|
];
|
||||||
|
};
|
||||||
|
imgs.pda = (pkgs-mobile.lib.nixosSystem {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
modules = [
|
||||||
|
mobile-nixos.nixosModules.pine64-pinephone ({
|
||||||
|
users.users.root.password = "147147";
|
||||||
|
})
|
||||||
|
({ pkgs, ... }: {
|
||||||
|
system.stateVersion = "21.11"; # Did you read the comment?
|
||||||
|
})
|
||||||
|
./image.nix
|
||||||
|
];
|
||||||
|
}).config.system.build.raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations.desko = self.decl-machine {
|
nixosConfigurations = {}
|
||||||
system = "x86_64-linux";
|
// self.machines.uninsane.nixosConfigurations
|
||||||
extraModules = [ ./machines/desko ];
|
// self.machines.desko.nixosConfigurations
|
||||||
};
|
// self.machines.lappy.nixosConfigurations
|
||||||
packages.x86_64-linux.desko-img = self.decl-img {
|
// self.machines.pda.nixosConfigurations
|
||||||
system = "x86_64-linux";
|
;
|
||||||
extraModules = [ ./machines/desko ];
|
imgs = {}
|
||||||
};
|
// self.machines.uninsane.imgs
|
||||||
|
// self.machines.desko.imgs
|
||||||
nixosConfigurations.lappy = self.decl-machine {
|
// self.machines.lappy.imgs
|
||||||
system = "x86_64-linux";
|
// self.machines.pda.imgs
|
||||||
extraModules = [ ./machines/lappy ];
|
;
|
||||||
};
|
|
||||||
packages.x86_64-linux.lappy-img = self.decl-img {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
extraModules = [ ./machines/lappy ];
|
|
||||||
};
|
|
||||||
|
|
||||||
nixosConfigurations.pda = pkgs-mobile.lib.nixosSystem {
|
|
||||||
# inherit (self.genpkgs.aarch64-linux) pkgs;
|
|
||||||
system = "aarch64-linux";
|
|
||||||
modules = [
|
|
||||||
# ({ pkgs, ... }: {
|
|
||||||
# nixpkgs.config.allowUnfree = true;
|
|
||||||
# })
|
|
||||||
# home-manager.nixosModules.home-manager {
|
|
||||||
# home-manager.useGlobalPkgs = true;
|
|
||||||
# home-manager.useUserPackages = true;
|
|
||||||
# home-manager.users.colin.imports = [ ./colin.nix ];
|
|
||||||
# }
|
|
||||||
# ./configuration.nix
|
|
||||||
# ./users.nix
|
|
||||||
mobile-nixos.nixosModules.pine64-pinephone ({
|
|
||||||
users.users.root.password = "147147";
|
|
||||||
})
|
|
||||||
({ pkgs, ... }: {
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "21.11"; # Did you read the comment?
|
|
||||||
})
|
|
||||||
# ({ pkgs, mobile-nixos, ... }: {
|
|
||||||
# imports = [
|
|
||||||
# (import "${mobile-nixos}/lib/configuration.nix" { device = "pine64-pinephone"; })
|
|
||||||
# ];
|
|
||||||
# })
|
|
||||||
# ({ pkgs, ... }: {
|
|
||||||
# imports = [
|
|
||||||
# <mobnixos>/devices/pine64-pinephone
|
|
||||||
# ];
|
|
||||||
# })
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
decl-machine = { system, extraModules }: (nixpkgs.lib.nixosSystem {
|
decl-machine = { system, extraModules }: (nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
pkgs = self.genpkgs."${system}".pkgs;
|
pkgs = self.genpkgs."${system}".pkgs;
|
||||||
system = "${system}";
|
|
||||||
specialArgs = { inherit home-manager; inherit nurpkgs; };
|
specialArgs = { inherit home-manager; inherit nurpkgs; };
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
@@ -120,6 +114,15 @@
|
|||||||
.config.system.build.raw
|
.config.system.build.raw
|
||||||
);
|
);
|
||||||
|
|
||||||
|
decl-bootable-machine = { name, system }: (
|
||||||
|
let extraModules = [ ./machines/${name} ];
|
||||||
|
in {
|
||||||
|
nixosConfigurations."${name}" = self.decl-machine { inherit system; inherit extraModules; };
|
||||||
|
imgs."${name}" = self.decl-img { inherit system; inherit extraModules; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# apply all our package overlays, but to all platforms possible.
|
||||||
genpkgs = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all (system:
|
genpkgs = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all (system:
|
||||||
{
|
{
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
|
@@ -19,7 +19,7 @@ but after that you can set them to their real value and run `git update-index --
|
|||||||
|
|
||||||
to build a distributable image (GPT-formatted image with rootfs and /boot partition):
|
to build a distributable image (GPT-formatted image with rootfs and /boot partition):
|
||||||
```sh
|
```sh
|
||||||
nix build .#lappy-gpt
|
nix build .#imgs.lappy
|
||||||
```
|
```
|
||||||
this can then be `dd`'d onto a disk and directly booted from a EFI system.
|
this can then be `dd`'d onto a disk and directly booted from a EFI system.
|
||||||
there's some post-processing to do before running a rebuild on the deployed system (e.g. change fstab UUIDs)
|
there's some post-processing to do before running a rebuild on the deployed system (e.g. change fstab UUIDs)
|
||||||
|
Reference in New Issue
Block a user