refactor: try to support cross compile nixos config
This commit is contained in:
parent
6e5b5e8c98
commit
a341473f6c
6 changed files with 46 additions and 40 deletions
68
flake.nix
68
flake.nix
|
@ -107,29 +107,14 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
mkHomeConfiguration = user: host: {
|
||||
name = user;
|
||||
value = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
modules = [
|
||||
(import ./home).${user}.${host}
|
||||
overlayModule
|
||||
] ++ sharedHmModules;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
};
|
||||
mkNixos =
|
||||
{
|
||||
system,
|
||||
modules,
|
||||
specialArgs ? { },
|
||||
}:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = specialArgs // {
|
||||
inherit inputs system;
|
||||
inherit inputs;
|
||||
};
|
||||
modules = [
|
||||
self.nixosModules.default
|
||||
|
@ -147,11 +132,9 @@
|
|||
};
|
||||
homeManagerModules = import ./modules/home-manager;
|
||||
|
||||
homeConfigurations = builtins.listToAttrs [ (mkHomeConfiguration "xin" "calcite") ];
|
||||
|
||||
colmenaHive = inputs.colmena.lib.makeHive {
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
nixpkgs = import nixpkgs { localSystem = "x86_64-linux"; };
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
|
@ -163,17 +146,13 @@
|
|||
deployment.targetHost = "49.13.13.122";
|
||||
deployment.buildOnTarget = true;
|
||||
|
||||
imports = [
|
||||
{ nixpkgs.system = "aarch64-linux"; }
|
||||
machines/massicot
|
||||
] ++ sharedColmenaModules;
|
||||
imports = [ machines/massicot ] ++ sharedColmenaModules;
|
||||
};
|
||||
|
||||
tok-00 =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ machines/dolomite ] ++ sharedColmenaModules;
|
||||
nixpkgs.system = "x86_64-linux";
|
||||
networking.hostName = "tok-00";
|
||||
system.stateVersion = "23.11";
|
||||
deployment = {
|
||||
|
@ -187,7 +166,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ machines/dolomite ] ++ sharedColmenaModules;
|
||||
nixpkgs.system = "x86_64-linux";
|
||||
networking.hostName = "la-00";
|
||||
system.stateVersion = "21.05";
|
||||
deployment = {
|
||||
|
@ -204,7 +182,6 @@
|
|||
targetHost = "raspite.local";
|
||||
buildOnTarget = false;
|
||||
};
|
||||
nixpkgs.system = "aarch64-linux";
|
||||
imports = [
|
||||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
|
@ -221,26 +198,28 @@
|
|||
targetPort = 22;
|
||||
buildOnTarget = false;
|
||||
};
|
||||
nixpkgs.system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations = {
|
||||
calcite = mkNixos {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.asus-zephyrus-ga401
|
||||
machines/calcite/configuration.nix
|
||||
(mkHome "xin" "calcite")
|
||||
];
|
||||
};
|
||||
} // self.colmenaHive.nodes;
|
||||
|
||||
}
|
||||
// flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs = import nixpkgs { localSystem = system; };
|
||||
|
||||
mkHomeConfiguration = user: host: {
|
||||
name = user;
|
||||
value = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
(import ./home).${user}.${host}
|
||||
overlayModule
|
||||
] ++ sharedHmModules;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells = {
|
||||
|
@ -259,7 +238,18 @@
|
|||
|
||||
packages = {
|
||||
nixvim = my-nixvim.packages.${system}.default;
|
||||
nixosConfigurations = {
|
||||
calcite = mkNixos {
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.asus-zephyrus-ga401
|
||||
machines/calcite/configuration.nix
|
||||
(mkHome "xin" "calcite")
|
||||
];
|
||||
};
|
||||
} // self.colmenaHive.nodes;
|
||||
};
|
||||
|
||||
homeConfigurations = builtins.listToAttrs [ (mkHomeConfiguration "xin" "calcite") ];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
11
garnix.yaml
Normal file
11
garnix.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
builds:
|
||||
exclude: []
|
||||
include:
|
||||
- '*.x86_64-linux.*'
|
||||
- defaultPackage.x86_64-linux
|
||||
- devShell.x86_64-linux
|
||||
- homeConfigurations.*
|
||||
- darwinConfigurations.*
|
||||
- nixosConfigurations.*
|
||||
- nixosConfigurations.aarch64-linux.calcite
|
||||
- homeConfigurations.aarch64-linux.xin
|
|
@ -16,6 +16,7 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg {
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ata_piix"
|
||||
"xhci_pci"
|
||||
|
|
|
@ -25,6 +25,8 @@ in
|
|||
};
|
||||
|
||||
config = mkIf config.isLightsail {
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
|
||||
boot.loader.grub.device = "/dev/nvme0n1";
|
||||
|
||||
# from nixpkgs amazon-image.nix
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
device = "/dev/sda1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = "aarch64-linux";
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
})
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = "aarch64-linux";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
libraspberrypi
|
||||
|
|
Loading…
Add table
Reference in a new issue