🔧 flakes + deploy-rs conversion

This commit is contained in:
James Walker 2022-05-03 21:00:37 -04:00
parent 17931a7b7b
commit 73a072ae49
Signed by: walkah
GPG Key ID: 3C127179D6086E93
5 changed files with 141 additions and 57 deletions

63
flake.lock generated
View File

@ -20,6 +20,27 @@
"type": "github"
}
},
"dotfiles": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1651201720,
"narHash": "sha256-nx4UKikzjZLunB1VUf5I8jFurn0rfc3y1xceb6deDmI=",
"owner": "walkah",
"repo": "dotfiles",
"rev": "a9529560bffd9d1093e957b9b5d7bdcedaa39f8e",
"type": "github"
},
"original": {
"owner": "walkah",
"repo": "dotfiles",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -52,15 +73,36 @@
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"dotfiles",
"nixpkgs"
]
},
"locked": {
"lastModified": 1640592198,
"narHash": "sha256-F5dWVGQMscmGyLTzNLocPB1v8Ijp8ONx8Nq9Dmi5PSw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0b197562ab7bf114dd5f6716f41d4b5be6ccd357",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1651007090,
"narHash": "sha256-C/OoQRzTUOWEr1sd3xTKA2GudA1YG1XB3MlL6KfTchg=",
"lastModified": 1651531343,
"narHash": "sha256-DBJFMNlWcht3jdKE2KVbcy1g/e/yryrSs1qSViQd4lE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "778af87a981eb2bfa3566dff8c3fb510856329ef",
"rev": "0304f0f58b4c538ff704c58d53a778b062810ec7",
"type": "github"
},
"original": {
@ -87,11 +129,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1651114127,
"narHash": "sha256-/lLC0wkMZkAdA5e1W76SnJzbhfOGDvync3VRHJMtAKk=",
"lastModified": 1651369430,
"narHash": "sha256-d86uUm0s11exU9zLo2K1AwtJQJDKubFpoF0Iw767uT4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6766fb6503ae1ebebc2a9704c162b2aef351f921",
"rev": "b283b64580d1872333a99af2b4cef91bb84580cf",
"type": "github"
},
"original": {
@ -101,11 +143,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1651007983,
"narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=",
"lastModified": 1651558728,
"narHash": "sha256-8HzyRnWlgZluUrVFNOfZAOlA1fghpOSezXvxhalGMUo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e10da1c7f542515b609f8dfbcf788f3d85b14936",
"rev": "cbe587c735b734405f56803e267820ee1559e6c1",
"type": "github"
},
"original": {
@ -118,8 +160,9 @@
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"dotfiles": "dotfiles",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_3"
}
},

111
flake.nix
View File

@ -6,9 +6,30 @@
home-manager.url = "github:nix-community/home-manager";
flake-utils.url = "github:numtide/flake-utils";
deploy-rs.url = "github:serokell/deploy-rs";
# My stuff
dotfiles = {
url = "github:walkah/dotfiles";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, deploy-rs, flake-utils, ... }:
outputs = { self, nixpkgs, deploy-rs, flake-utils, home-manager, dotfiles, ... }@attrs:
let
mkSystem = hostName: system: modules:
nixpkgs.lib.nixosSystem {
system = system;
modules = [
home-manager.nixosModules.home-manager
({ config, ... }: {
networking.hostName = hostName;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
})
]
++ modules;
};
in
flake-utils.lib.eachDefaultSystem
(system:
let
@ -16,35 +37,18 @@
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
deploy-rs.packages.${system}.deploy-rs
pkgs.sops
];
buildInputs = [ deploy-rs.packages.${system}.deploy-rs pkgs.sops ];
};
}
)
// {
}) // {
nixosConfigurations = {
agent = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/aristotle/configuration.nix
({ config, ... }: {
networking.hostName = "agent";
})
];
};
form = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/aristotle/configuration.nix
({ config, ... }: {
networking.hostName = "form";
})
];
};
# Aristotle
agent = mkSystem "agent" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
form = mkSystem "form" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
matter = mkSystem "matter" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
purpose = mkSystem "purpose" "aarch64-linux" [ ./hosts/aristotle/configuration.nix ];
plato = mkSystem "plato" "x86_64-linux" [ ./hosts/plato/configuration.nix ];
socrates = mkSystem "socrates" "x86_64-linux" [ ./hosts/socrates/configuration.nix ];
};
deploy.nodes = {
@ -67,6 +71,59 @@
self.nixosConfigurations.form;
};
};
matter = {
hostname = "matter";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.matter;
};
};
purpose = {
hostname = "purpose";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.aarch64-linux.activate.nixos
self.nixosConfigurations.purpose;
};
};
plato = {
hostname = "plato";
profiles = {
system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.plato;
};
walkah = {
user = "walkah";
path = deploy-rs.lib.x86_64-linux.activate.home-manager
dotfiles.homeConfigurations.x86_64-linux;
};
};
};
socrates = {
hostname = "socrates";
sshUser = "root";
profiles = {
system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.socrates;
};
walkah = {
user = "walkah";
path = deploy-rs.lib.x86_64-linux.activate.home-manager
dotfiles.homeConfigurations.x86_64-linux;
};
};
};
};
};
}

View File

@ -1,14 +1,7 @@
{ config, pkgs, ... }:
let
dotfiles = builtins.fetchTarball
"https://github.com/walkah/dotfiles/archive/main.tar.gz";
in
{
{ config, pkgs, home-manager, ... }: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
../../modules/coredns
../../modules/code-server
@ -52,7 +45,6 @@ in
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8YMax7PGIrcPNIHkpuNRFgn3HJK6Wepm+ycZWO6jfR walkah@walkah-ipadpro11"
];
};
home-manager.users.walkah = import "${dotfiles}/home.nix";
system.autoUpgrade.enable = false;
environment.systemPackages = with pkgs; [ docker-compose pinentry weechat ];

View File

@ -1,14 +1,7 @@
{ pkgs, ... }:
let
dotfiles = builtins.fetchTarball
"https://github.com/walkah/dotfiles/archive/main.tar.gz";
in
{
{ pkgs, ... }: {
imports = [
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
<home-manager/nixos>
../../modules/coredns
../../modules/code-server/nginx.nix
@ -47,7 +40,6 @@ in
];
};
};
home-manager.users.walkah = import "${dotfiles}/home.nix";
system.autoUpgrade.enable = false;
environment.systemPackages = with pkgs; [ ipfs-migrator ];

View File

@ -1,6 +1,6 @@
{ ... }:
{ modulesPath, ... }:
{
imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub.device = "/dev/vda";
fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; };
}