Snowfall lib - initial work
Switch to treefmt
This commit is contained in:
parent
2fbee2adb5
commit
bca554318e
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -3,5 +3,5 @@
|
|||
"direnv.restart.automatic": true,
|
||||
"nix.enableLanguageServer": true,
|
||||
"nix.serverPath": "/run/current-system/sw/bin/nil",
|
||||
"nix.formatterPath": "/run/current-system/sw/bin/nix fmt",
|
||||
"nix.formatterPath": "/run/current-system/sw/bin/nix fmt"
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ nixos-rebuild build-vm --flake .
|
|||
### Layout
|
||||
|
||||
This config uses a custom templating system built off of the [Auxolotl system templates](https://git.auxolotl.org/auxolotl/templates).
|
||||
|
||||
- Flakes are the entrypoint, via `flake.nix`. This is where Flake inputs and Flake-specific options get defined.
|
||||
- Hosts are defined in the `hosts` folder.
|
||||
- Modules are defined in `modules`. All of these files are automatically imported (except home-manager modules). You simply enable the ones you want to use, and disable the ones you don't. For example, to install Flatpak support, set `aux.system.ui.flatpak.enable = true;`.
|
||||
|
|
130
flake.lock
130
flake.lock
|
@ -58,6 +58,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
|
@ -97,6 +113,25 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils-plus": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715533576,
|
||||
"narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
|
@ -115,6 +150,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flakey-profile": {
|
||||
"locked": {
|
||||
"lastModified": 1712898590,
|
||||
|
@ -198,21 +251,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1728413071,
|
||||
"narHash": "sha256-5WHctvz0R9N9oBGda1ROuJ/V/m/tZsEXloGWDrd9G7Y=",
|
||||
"rev": "866b8902c975a1aaec547445976dd39d60def4ab",
|
||||
"type": "tarball",
|
||||
"url": "https://git.auxolotl.org/api/v1/repos/auxolotl/labs/archive/866b8902c975a1aaec547445976dd39d60def4ab.tar.gz?rev=866b8902c975a1aaec547445976dd39d60def4ab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"type": "tarball",
|
||||
"url": "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"lix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -379,12 +417,13 @@
|
|||
"auto-cpufreq": "auto-cpufreq",
|
||||
"home-manager": "home-manager",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"lib": "lib",
|
||||
"lix-module": "lix-module",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"snowfall-lib": "snowfall-lib",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
@ -412,6 +451,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"snowfall-lib": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils-plus": "flake-utils-plus",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732544274,
|
||||
"narHash": "sha256-qvzLIxuqukl0nxpXHEh5+iw1BLeLxYOwRC0+7cFUbPo=",
|
||||
"owner": "snowfallorg",
|
||||
"repo": "lib",
|
||||
"rev": "cfeacd055545ab5de0ecfd41e09324dcd8fb2bbb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "snowfallorg",
|
||||
"repo": "lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
@ -441,6 +502,41 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"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": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1733222881,
|
||||
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
100
flake.nix
100
flake.nix
|
@ -25,9 +25,6 @@
|
|||
# SecureBoot support
|
||||
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
||||
|
||||
# Aux lib
|
||||
lib.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=lib";
|
||||
|
||||
# Use Lix in place of Nix.
|
||||
# If you'd rather use regular Nix, remove `lix-module.nixosModules.default` from the `modules` section below.
|
||||
# To learn more about Lix, see https://lix.systems/
|
||||
|
@ -41,29 +38,54 @@
|
|||
|
||||
# NixOS hardware quirks
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
|
||||
# Snowfall - a unified configuration manager for NixOS
|
||||
# Quickstart guide: https://snowfall.org/guides/lib/quickstart/
|
||||
# Jake's reference config: https://github.com/jakehamilton/config
|
||||
snowfall-lib = {
|
||||
url = "github:snowfallorg/lib";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{
|
||||
auto-cpufreq,
|
||||
home-manager,
|
||||
lanzaboote,
|
||||
lix-module,
|
||||
nix-flatpak,
|
||||
nixos-hardware,
|
||||
nixpkgs,
|
||||
...
|
||||
}:
|
||||
inputs:
|
||||
let
|
||||
forAllSystems =
|
||||
function:
|
||||
nixpkgs.lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
] (system: function nixpkgs.legacyPackages.${system});
|
||||
lib = inputs.snowfall-lib.mkLib {
|
||||
inherit inputs;
|
||||
|
||||
# Define shared modules and imports
|
||||
defaultModules = [
|
||||
# Root dir for flake.nix
|
||||
src = ./.;
|
||||
|
||||
# Configure Snowfall
|
||||
snowfall = {
|
||||
# Choose a namespace to use for your flake's packages, library, and overlays.
|
||||
namespace = "Sapana";
|
||||
|
||||
# Add flake metadata that can be processed by tools like Snowfall Frost.
|
||||
meta = {
|
||||
# A slug to use in documentation when displaying things like file paths.
|
||||
name = "aires-flake";
|
||||
|
||||
# A title to show for your flake, typically the name.
|
||||
title = "Aires' Flake";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.mkFlake {
|
||||
# Configure Nix channels
|
||||
channels-config.allowUnfree = true;
|
||||
|
||||
# Define systems
|
||||
systems = {
|
||||
# Modules to import for all systems
|
||||
modules.nixos = with inputs; [
|
||||
./modules/autoimport.nix
|
||||
auto-cpufreq.nixosModules.default
|
||||
lix-module.nixosModules.default
|
||||
|
@ -86,52 +108,40 @@
|
|||
};
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
||||
|
||||
nixosConfigurations = {
|
||||
|
||||
Dimaga = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = defaultModules ++ [
|
||||
# Individual host configurations
|
||||
hosts = {
|
||||
Dimaga.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.common-cpu-intel
|
||||
./hosts/Dimaga
|
||||
];
|
||||
};
|
||||
|
||||
Hevana = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = defaultModules ++ [
|
||||
Hevana.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.common-cpu-amd-pstate
|
||||
nixos-hardware.nixosModules.common-gpu-amd
|
||||
./hosts/Hevana
|
||||
];
|
||||
};
|
||||
|
||||
Khanda = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = defaultModules ++ [
|
||||
Khanda.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.microsoft-surface-pro-9
|
||||
./hosts/Khanda
|
||||
];
|
||||
};
|
||||
|
||||
Pihole = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = defaultModules ++ [
|
||||
Pihole.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
./hosts/Pihole
|
||||
];
|
||||
};
|
||||
|
||||
Shura = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = defaultModules ++ [
|
||||
Shura.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.lenovo-legion-16arha7
|
||||
./hosts/Shura
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Use treefmt to format project repo
|
||||
outputs-builder = channels: {
|
||||
formatter = (inputs.treefmt-nix.lib.evalModule channels.nixpkgs ./treefmt.nix).config.build.wrapper;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
}:
|
||||
|
||||
{
|
||||
aux.system = {
|
||||
# Install base packages
|
||||
aux.system.packages = with pkgs; [
|
||||
packages = with pkgs; [
|
||||
fastfetch # Show a neat system statistics screen when opening a terminal
|
||||
htop # System monitor
|
||||
lm_sensors # System temperature monitoring
|
||||
|
@ -15,7 +16,8 @@
|
|||
];
|
||||
|
||||
# Install the nos helper script
|
||||
aux.system.nixos-operations-script.enable = true;
|
||||
nixos-operations-script.enable = true;
|
||||
};
|
||||
|
||||
# Allow packages from the unstable repo by using 'pkgs.unstable'
|
||||
nixpkgs.overlays = [
|
||||
|
|
15
treefmt.nix
Normal file
15
treefmt.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Configure formatter for .nix and other repo files
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
programs = {
|
||||
beautysh.enable = true;
|
||||
nixfmt = {
|
||||
enable = true;
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
prettier.enable = true;
|
||||
yamlfmt.enable = true;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue