make things work with flake-parts

also don't use my fork for btrbk anymore
This commit is contained in:
cy 2025-01-16 16:11:24 -05:00
parent ff3df36198
commit 193fc258b9
4 changed files with 223 additions and 151 deletions

126
flake.lock generated
View file

@ -80,6 +80,22 @@
}
},
"flake-compat_2": {
"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-compat_3": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
@ -94,6 +110,24 @@
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"lanzaboote",
@ -114,7 +148,7 @@
"type": "github"
}
},
"flake-parts_2": {
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
@ -172,12 +206,34 @@
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1737043064,
"narHash": "sha256-I/OuxGwXwRi5gnFPsyCvVR+IfFstA+QXEpHu1hvsgD8=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "94ee657f6032d913fe0ef49adaa743804635b0bb",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": [
"nixvim",
"flake-compat"
],
"gitignore": "gitignore_2",
"gitignore": "gitignore_3",
"nixpkgs": [
"nixvim",
"nixpkgs"
@ -198,6 +254,27 @@
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"lanzaboote",
@ -219,7 +296,7 @@
"type": "github"
}
},
"gitignore_2": {
"gitignore_3": {
"inputs": {
"nixpkgs": [
"nixvim",
@ -313,8 +390,8 @@
"lanzaboote": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
@ -374,22 +451,6 @@
"type": "github"
}
},
"nixpkgs-btrbk": {
"locked": {
"lastModified": 1735945390,
"narHash": "sha256-isFSp8EsqnFJE7o07XdT/eia0Rtzvz6NqLt4tCdFido=",
"owner": "cything",
"repo": "nixpkgs",
"rev": "acf701b49a7687e23b4b18701d4ab62285dec029",
"type": "github"
},
"original": {
"owner": "cything",
"ref": "btrbk",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-garage": {
"locked": {
"lastModified": 1736921030,
@ -406,6 +467,18 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1735774519,
"narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1710695816,
@ -425,9 +498,9 @@
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_3",
"git-hooks": "git-hooks_2",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
@ -479,7 +552,7 @@
"lanzaboote",
"flake-compat"
],
"gitignore": "gitignore",
"gitignore": "gitignore_2",
"nixpkgs": [
"lanzaboote",
"nixpkgs"
@ -503,10 +576,11 @@
"root": {
"inputs": {
"disko": "disko",
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"nixpkgs": "nixpkgs",
"nixpkgs-btrbk": "nixpkgs-btrbk",
"nixpkgs-garage": "nixpkgs-garage",
"nixvim": "nixvim",
"sops-nix": "sops-nix",

122
flake.nix
View file

@ -27,21 +27,21 @@
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-btrbk.url = "github:cything/nixpkgs/btrbk"; # unmerged PR
nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR
};
nixConfig = {
extra-substituters = [
"https://cache.cything.io/central"
"https://cache.cything.io/infra-ci"
"https://cache.cything.io/attic"
];
extra-trusted-public-keys = [
"central:uWhjva6m6dhC2hqNisjn2hXGvdGBs19vPkA1dPEuwFg="
"infra-ci:xG5f5tddUBcvToYjlpHD5OY/puYQkKmgKeIQCshNs38="
"attic:HL3hVpqXxwcF7Q1R+IvU2i0+YxIjQA2xxKM5EJMXLLs="
];
builders-use-substitutes = true;
};
@ -53,59 +53,55 @@
home-manager,
treefmt,
disko,
flake-parts,
...
}@inputs:
let
lib = nixpkgs.lib;
inherit (self) outputs;
systems = [ "x86_64-linux" ];
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
overlays = [
# (overlayPkgsFromFlake inputs.eza [
# ])
] ++ import ./overlay;
pkgsFor = lib.genAttrs systems (
system:
import nixpkgs {
inherit system overlays;
flake-parts.lib.mkFlake { inherit inputs; } (
{ ... }:
{
imports = [
inputs.git-hooks.flakeModule
];
debug = true;
systems = [
"x86_64-linux"
];
perSystem =
{
pkgs,
system,
...
}:
{
# make pkgs available to `perSystem`
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
}
);
};
treefmtEval = forEachSystem (
pkgs:
treefmt.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.stylua.enable = true;
programs.yamlfmt.enable = true;
programs.typos.enable = true;
programs.shellcheck.enable = true;
programs.deadnix.enable = true;
pre-commit = {
check.enable = true;
settings.hooks = {
nixfmt-rfc-style.enable = true;
};
};
settings.global.excludes = [ "secrets/*" ];
}
);
in
{
formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
checks = forEachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
# lets us build overlaid packages with `nix build .#<package>`
packages = pkgsFor;
formatter = pkgs.nixfmt-rfc-style;
};
flake = {
nixosConfigurations =
let
pkgs = pkgsFor.x86_64-linux;
pkgs = import nixpkgs {
config.allowUnfree = true;
system = "x86_64-linux";
};
lib = nixpkgs.lib;
in
{
ytnix = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
{
nixpkgs = { inherit pkgs; };
@ -116,9 +112,8 @@
inputs.lanzaboote.nixosModules.lanzaboote
];
};
chunk = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs = { inherit pkgs; };
@ -134,7 +129,7 @@
};
titan = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs = { inherit pkgs; };
@ -146,29 +141,36 @@
];
};
};
homeConfigurations = {
"yt@ytnix" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
homeConfigurations =
let
pkgs = import nixpkgs {
config.allowUnfree = true;
system = "x86_64-linux";
};
lib = home-manager.lib;
in
{
"yt@ytnix" = lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
./home/yt/ytnix.nix
inputs.nixvim.homeManagerModules.nixvim
];
};
"yt@chunk" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
"yt@chunk" = lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
./home/yt/chunk.nix
inputs.nixvim.homeManagerModules.nixvim
];
};
"codespace@codespace" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
"codespace@codespace" = lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
./home/yt/codespace.nix
inputs.nixvim.homeManagerModules.nixvim
@ -177,3 +179,5 @@
};
};
}
);
}

View file

@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
package = pkgs.vscodium;

View file

@ -1,7 +1,6 @@
{
config,
pkgs,
inputs,
lib,
...
}:
@ -10,12 +9,6 @@
./hardware-configuration.nix
../common.nix
../zsh.nix
{
disabledModules = [
"services/backup/btrbk.nix"
];
}
(inputs.nixpkgs-btrbk + "/nixos/modules/services/backup/btrbk.nix")
];
sops.age.keyFile = "/root/.config/sops/age/keys.txt";