migration to flake-parts
This commit is contained in:
parent
1b743f9fcc
commit
6497dede6f
46
flake.lock
generated
46
flake.lock
generated
@ -232,6 +232,24 @@
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1759362264,
|
||||
"narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "758cf7296bee11f1706a574c77d072b8a7baa881",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_3": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
@ -245,7 +263,7 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"flake-parts_3": {
|
||||
"flake-parts_4": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nur",
|
||||
@ -266,7 +284,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_4": {
|
||||
"flake-parts_5": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"stylix",
|
||||
@ -681,7 +699,7 @@
|
||||
},
|
||||
"nix-gaming": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-parts": "flake-parts_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
@ -768,6 +786,21 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_2": {
|
||||
"locked": {
|
||||
"lastModified": 1754788789,
|
||||
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_3": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1711703276,
|
||||
@ -835,7 +868,7 @@
|
||||
},
|
||||
"nixtendo-switch": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_2",
|
||||
"flake-parts": "flake-parts_3",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
@ -856,7 +889,7 @@
|
||||
},
|
||||
"nur": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_3",
|
||||
"flake-parts": "flake-parts_4",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
@ -943,6 +976,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"doom-emacs": "doom-emacs",
|
||||
"flake-parts": "flake-parts",
|
||||
"fonts": "fonts",
|
||||
"home-manager": "home-manager",
|
||||
"hyprland": "hyprland",
|
||||
@ -988,7 +1022,7 @@
|
||||
"base16-helix": "base16-helix",
|
||||
"base16-vim": "base16-vim",
|
||||
"firefox-gnome-theme": "firefox-gnome-theme",
|
||||
"flake-parts": "flake-parts_4",
|
||||
"flake-parts": "flake-parts_5",
|
||||
"gnome-shell": "gnome-shell",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
|
||||
79
flake.nix
79
flake.nix
@ -1,6 +1,8 @@
|
||||
{
|
||||
description = "JawZ NixOS flake setup";
|
||||
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
|
||||
nixpkgs-small.url = "github:nixos/nixpkgs?ref=nixos-25.05-small";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
@ -59,76 +61,13 @@
|
||||
};
|
||||
};
|
||||
outputs =
|
||||
{ self, jawz-scripts, ... }@inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
system = "x86_64-linux";
|
||||
mkpkgs =
|
||||
repo:
|
||||
import repo {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
langList = builtins.filter (name: name != "emacs") (
|
||||
builtins.map (file: builtins.replaceStrings [ ".nix" ] [ "" ] (baseNameOf file)) (
|
||||
builtins.attrNames (builtins.readDir ./modules/dev)
|
||||
)
|
||||
);
|
||||
commonModules = name: [
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import ./config/overlay.nix { inherit mkpkgs inputs; })
|
||||
inputs.doom-emacs.overlays.default
|
||||
];
|
||||
}
|
||||
{
|
||||
nix.registry = {
|
||||
jawz.flake = self;
|
||||
unstable.flake = inputs.nixpkgs-unstable;
|
||||
};
|
||||
}
|
||||
./hosts/${name}/configuration.nix
|
||||
inputs.nur.modules.nixos.default
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.stylix.nixosModules.stylix
|
||||
inputs.nixtendo-switch.nixosModules.nixtendo-switch
|
||||
inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
./parts/core.nix
|
||||
./parts/hosts.nix
|
||||
./parts/packages.nix
|
||||
./parts/devshells.nix
|
||||
];
|
||||
createConfig =
|
||||
name: local-nixpkgs:
|
||||
let
|
||||
lib = local-nixpkgs.lib // inputs.home-manager.lib;
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
};
|
||||
modules = commonModules name;
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
workstation = createConfig "workstation" inputs.nixpkgs;
|
||||
miniserver = createConfig "miniserver" inputs.nixpkgs-small;
|
||||
server = createConfig "server" inputs.nixpkgs-small;
|
||||
galaxy = createConfig "galaxy" inputs.nixpkgs-small;
|
||||
emacs = createConfig "emacs" inputs.nixpkgs;
|
||||
};
|
||||
packages.${system} = (jawz-scripts.packages.${system} or { }) // {
|
||||
emacs-vm = inputs.nixos-generators.nixosGenerate {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
};
|
||||
modules = commonModules "emacs";
|
||||
format = "vm";
|
||||
};
|
||||
};
|
||||
devShells.${system} = builtins.listToAttrs (
|
||||
map (name: {
|
||||
inherit name;
|
||||
value = self.nixosConfigurations.emacs.config.devShells.${name};
|
||||
}) langList
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
54
parts/core.nix
Normal file
54
parts/core.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ inputs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
mkpkgs =
|
||||
repo:
|
||||
import repo {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
systems = [ system ];
|
||||
flake = {
|
||||
lib = {
|
||||
commonModules = name: [
|
||||
../hosts/${name}/configuration.nix
|
||||
inputs.nur.modules.nixos.default
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.stylix.nixosModules.stylix
|
||||
inputs.nixtendo-switch.nixosModules.nixtendo-switch
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import ../config/overlay.nix { inherit mkpkgs inputs; })
|
||||
inputs.doom-emacs.overlays.default
|
||||
];
|
||||
}
|
||||
{
|
||||
nix.registry = {
|
||||
jawz.flake = inputs.self;
|
||||
unstable.flake = inputs.nixpkgs-unstable;
|
||||
};
|
||||
}
|
||||
];
|
||||
createConfig =
|
||||
name: local-nixpkgs:
|
||||
let
|
||||
lib = local-nixpkgs.lib // inputs.home-manager.lib;
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = inputs.self.lib.commonModules name;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
outputs = inputs.self;
|
||||
};
|
||||
};
|
||||
langList =
|
||||
builtins.readDir ../modules/dev
|
||||
|> builtins.attrNames
|
||||
|> map (file: baseNameOf file |> builtins.replaceStrings [ ".nix" ] [ "" ])
|
||||
|> builtins.filter (name: name != "emacs");
|
||||
};
|
||||
};
|
||||
}
|
||||
12
parts/devshells.nix
Normal file
12
parts/devshells.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
perSystem = _: {
|
||||
devShells =
|
||||
inputs.self.lib.langList
|
||||
|> map (name: {
|
||||
inherit name;
|
||||
value = inputs.self.nixosConfigurations.emacs.config.devShells.${name};
|
||||
})
|
||||
|> builtins.listToAttrs;
|
||||
};
|
||||
}
|
||||
10
parts/hosts.nix
Normal file
10
parts/hosts.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.nixosConfigurations = {
|
||||
workstation = inputs.self.lib.createConfig "workstation" inputs.nixpkgs;
|
||||
miniserver = inputs.self.lib.createConfig "miniserver" inputs.nixpkgs-small;
|
||||
server = inputs.self.lib.createConfig "server" inputs.nixpkgs-small;
|
||||
galaxy = inputs.self.lib.createConfig "galaxy" inputs.nixpkgs-small;
|
||||
emacs = inputs.self.lib.createConfig "emacs" inputs.nixpkgs;
|
||||
};
|
||||
}
|
||||
18
parts/packages.nix
Normal file
18
parts/packages.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ system, ... }:
|
||||
{
|
||||
packages = (inputs.jawz-scripts.packages.${system} or { }) // {
|
||||
emacs-vm = inputs.nixos-generators.nixosGenerate {
|
||||
inherit system;
|
||||
modules = inputs.self.lib.commonModules "emacs";
|
||||
format = "vm";
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
outputs = inputs.self;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user