refactor(flake): hand roll flake
This commit is contained in:
parent
9567cce5fa
commit
bd88d8382c
5 changed files with 89 additions and 100 deletions
23
flake.lock
23
flake.lock
|
@ -980,8 +980,7 @@
|
|||
"nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"smartcolumn-nvim": "smartcolumn-nvim",
|
||||
"stable": "stable",
|
||||
"utils": "utils"
|
||||
"stable": "stable"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
@ -1083,26 +1082,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1657226504,
|
||||
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wlroots": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
134
flake.nix
134
flake.nix
|
@ -13,8 +13,6 @@
|
|||
stable.url = "github:nixos/nixpkgs/nixos-22.11";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||
utils.inputs.flake-utils.follows = "flake-utils";
|
||||
|
||||
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
|
@ -79,50 +77,51 @@
|
|||
║ Outputs ║
|
||||
╚══════════════════════════════════════════════════════════╝
|
||||
*/
|
||||
outputs =
|
||||
inputs@{ self, nixpkgs, utils, ... }:
|
||||
utils.lib.mkFlake {
|
||||
inherit self inputs;
|
||||
outputs = inputs@{ self, nixpkgs, ... }:
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
|
||||
channelsConfig.allowUnfree = true;
|
||||
forEachSystem = lib.genAttrs systems;
|
||||
|
||||
lib = nixpkgs.lib.extend
|
||||
(self: _: { my = import ./lib { lib = self; }; });
|
||||
|
||||
/*
|
||||
╔══════════════════════════════════════════════════════════╗
|
||||
║ Overlays ║
|
||||
╚══════════════════════════════════════════════════════════╝
|
||||
*/
|
||||
overlay = import ./overlays {
|
||||
inherit inputs;
|
||||
inherit (self) lib;
|
||||
};
|
||||
|
||||
channels.nixpkgs.overlaysBuilder = _: [
|
||||
config.allowUnfree = true;
|
||||
|
||||
overlays = [
|
||||
inputs.hypr-contrib.overlays.default
|
||||
inputs.hyprland.overlays.default
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
inputs.utils.overlay
|
||||
self.overlay
|
||||
overlay
|
||||
];
|
||||
|
||||
overlays = utils.lib.exportOverlays
|
||||
{
|
||||
inherit (self) pkgs inputs;
|
||||
} // {
|
||||
default = self.overlay;
|
||||
pkgsFor = system: import nixpkgs {
|
||||
inherit system config;
|
||||
overlays = overlays ++ [
|
||||
(
|
||||
_: prev: {
|
||||
master = import inputs.master {
|
||||
inherit (prev) system;
|
||||
inherit overlays config;
|
||||
};
|
||||
stable = import inputs.stable {
|
||||
inherit (prev) system;
|
||||
inherit overlays config;
|
||||
};
|
||||
}
|
||||
)
|
||||
overlay
|
||||
];
|
||||
};
|
||||
|
||||
/*
|
||||
╔══════════════════════════════════════════════════════════╗
|
||||
║ Modules ║
|
||||
╚══════════════════════════════════════════════════════════╝
|
||||
*/
|
||||
hostDefaults.modules = [
|
||||
./modules/default.nix
|
||||
defaultModules = [
|
||||
{ nixpkgs = { inherit config; }; }
|
||||
./modules
|
||||
inputs.home-manager.nixosModule
|
||||
{
|
||||
home-manager = {
|
||||
|
@ -134,35 +133,22 @@
|
|||
inputs.agenix.nixosModules.age
|
||||
];
|
||||
|
||||
|
||||
hosts.nixos-laptop.modules = [
|
||||
./hosts/nixos-laptop
|
||||
];
|
||||
|
||||
|
||||
hosts.nixos-desktop.modules = [
|
||||
./hosts/nixos-desktop
|
||||
];
|
||||
|
||||
/*
|
||||
╔══════════════════════════════════════════════════════════╗
|
||||
║ Other Outputs ║
|
||||
╚══════════════════════════════════════════════════════════╝
|
||||
*/
|
||||
outputsBuilder = channels:
|
||||
with channels.nixpkgs; {
|
||||
devShells.default = mkShell {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
name = "dotfiles";
|
||||
packages = [
|
||||
# Secrets
|
||||
pkgs.agenix
|
||||
# cachix
|
||||
cachix
|
||||
];
|
||||
hosts = self.lib.my.mapModules
|
||||
(path:
|
||||
let
|
||||
system = import "${path}/system.nix";
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit pkgs system lib;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
modules = defaultModules ++ [ path ];
|
||||
})
|
||||
./hosts;
|
||||
|
||||
checks.pre-commit-check = inputs.pre-commit-hooks.lib."${system}".run {
|
||||
pre-commit-check = system: inputs.pre-commit-hooks.lib."${system}".run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixpkgs-fmt.enable = true;
|
||||
|
@ -171,8 +157,42 @@
|
|||
stylua.enable = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
with lib; {
|
||||
inherit lib;
|
||||
|
||||
packages = utils.lib.exportPackages self.overlays channels;
|
||||
pkgs = genAttrs systems pkgsFor;
|
||||
|
||||
# ╔══════════════════════════════════════════════════════════╗
|
||||
# ║ NixOS Configurations ║
|
||||
# ╚══════════════════════════════════════════════════════════╝
|
||||
|
||||
nixosConfigurations = hosts;
|
||||
|
||||
# ╔══════════════════════════════════════════════════════════╗
|
||||
# ║ Other Outputs ║
|
||||
# ╚══════════════════════════════════════════════════════════╝
|
||||
|
||||
devShells = forEachSystem (system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell
|
||||
{
|
||||
inherit (pre-commit-check system) shellHook;
|
||||
name = "dotfiles";
|
||||
packages = with pkgs; [
|
||||
# Secrets
|
||||
agenix
|
||||
# cachix
|
||||
cachix
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
checks = forEachSystem (system: {
|
||||
pre-commit-check = pre-commit-check system;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
1
hosts/nixos-desktop/system.nix
Normal file
1
hosts/nixos-desktop/system.nix
Normal file
|
@ -0,0 +1 @@
|
|||
"x86_64-linux"
|
1
hosts/nixos-laptop/system.nix
Normal file
1
hosts/nixos-laptop/system.nix
Normal file
|
@ -0,0 +1 @@
|
|||
"x86_64-linux"
|
|
@ -1,12 +0,0 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
_: prev: {
|
||||
master = import inputs.master {
|
||||
inherit (prev) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
stable = import inputs.stable {
|
||||
inherit (prev) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue