Merge pull request 'nix-rewrite' (#4) from nix-rewrite into main

Reviewed-on: #4
This commit is contained in:
Joseph Hanson 2024-02-29 02:47:17 +00:00
commit 4b40a072ea
5 changed files with 151 additions and 10 deletions

View file

@ -1,5 +1,43 @@
{
"nodes": {
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1708091384,
"narHash": "sha256-dTGGw2y8wvfjr+J9CjQbfdulOq72hUG17HXVNxpH1yE=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "0a0187794ac7f7a1e62cda3dabf8dc041f868790",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -63,11 +101,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1708294118,
"narHash": "sha256-evZzmLW7qoHXf76VCepvun1esZDxHfVRFUJtumD7L2M=",
"lastModified": 1708979614,
"narHash": "sha256-FWLWmYojIg6TeqxSnHkKpHu5SGnFP5um1uUjH+wRV6g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e0da498ad77ac8909a980f07eff060862417ccf7",
"rev": "b7ee09cf5614b02d289cd86fcfa6f24d4e078c2a",
"type": "github"
},
"original": {
@ -97,11 +135,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1708210246,
"narHash": "sha256-Q8L9XwrBK53fbuuIFMbjKvoV7ixfLFKLw4yV+SD28Y8=",
"lastModified": 1708819810,
"narHash": "sha256-1KosU+ZFXf31GPeCBNxobZWMgHsSOJcrSFA6F2jhzdE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "69405156cffbdf2be50153f13cbdf9a0bea38e49",
"rev": "89a2a12e6c8c6a56c72eb3589982c8e2f89c70ea",
"type": "github"
},
"original": {
@ -113,6 +151,7 @@
},
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"home-manager": "home-manager",
"nix-fast-build": "nix-fast-build",
"nixpkgs": "nixpkgs",
@ -127,11 +166,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1708500294,
"narHash": "sha256-mvJIecY3tDKZh7297mqOtOuAvP7U1rqjfLNfmfkjFpU=",
"lastModified": 1708987867,
"narHash": "sha256-k2lDaDWNTU5sBVHanYzjDKVDmk29RHIgdbbXu5sdzBA=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "f6b80ab6cd25e57f297fe466ad689d8a77057c11",
"rev": "a1c8de14f60924fafe13aea66b46157f0150f4cf",
"type": "github"
},
"original": {
@ -140,6 +179,21 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
@ -160,6 +214,24 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -39,7 +39,25 @@
# The `@` syntax here is used to alias the attribute set of the
# inputs's parameter, making it convenient to use inside the function.
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
in
{
hosts = import ./hosts.nix;
pkgs = forAllSystems (localSystem: import nixpkgs {
inherit localSystem;
config = {
allowUnfree = true;
allowAliases = true;
};
});
packages = forAllSystems (import ./packages inputs);
nixosConfigurations = {
"durincore" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@ -87,5 +105,6 @@
];
};
};
};
}

View file

@ -98,6 +98,7 @@
kubernetes-helm
cilium-cli
hubble
lens
# misc
fastfetch
@ -110,6 +111,7 @@
gawk
zstd
gnupg
fira-code-nerdfont
# nix related
#
@ -150,6 +152,7 @@
# Dev
vscode
termius
atuin
];
# starship - an customizable prompt for any shell

21
hosts.nix Normal file
View file

@ -0,0 +1,21 @@
{
durincore = {
type = "nixos";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
};
gandalf = {
type = "nixos";
address = "gandalf.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
este = {
type = "nixos";
address = "este.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
}

26
packages/default.nix Normal file
View file

@ -0,0 +1,26 @@
{
self,
nix-fast-build,
...
}:
hostPlatform:
let
inherit (self.pkgs."x86_64-linux") callPackage lib linkFarm;
hostDrvs = lib.mapAttrs (_: nixos: nixos.config.system.build.toplevel) self.nixosConfigurations;
compatHosts = lib.filterAttrs (_: host: host.hostPlatform == hostPlatform) self.hosts;
compatHostDrvs = lib.mapAttrs
(name: _: hostDrvs.${name})
compatHosts;
compatHostsFarm = linkFarm "hosts-x86_64-linux" (lib.mapAttrsToList (name: path: { inherit name path; }) compatHostDrvs);
in
compatHostDrvs
// (lib.optionalAttrs (compatHosts != { }) {
default = compatHostsFarm;
}) // {
inherit (nix-fast-build.packages."x86_64-linux") nix-fast-build;
inherit (self.pkgs."x86_64-linux") cachix nix-eval-jobs;
}