Additional cleanup - now getting at flake.nix
This commit is contained in:
parent
13efb4de95
commit
4bc4adc5be
29
README.md
29
README.md
|
@ -17,21 +17,30 @@ Initialize the submodule with:
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
### Applying the configuration
|
### Installing and upgrading
|
||||||
|
|
||||||
To apply the config for the first time (e.g. on a fresh install), run this command, replacing `Shura` with the name of the host:
|
To apply the config for the first time (e.g. on a fresh install), run these commands, replacing `Shura` with the name of the host:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
nix flake update
|
||||||
sudo nixos-rebuild switch --flake .#Shura
|
sudo nixos-rebuild switch --flake .#Shura
|
||||||
```
|
```
|
||||||
|
|
||||||
For subsequent builds, you can omit the hostname, and/or use nh:
|
`nix flake update` updates the `flake.lock` file, which pins repositories to specific versions. Nix will then pull down any derivations it needs to meet the version.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This config installs a [Nix wrapper called nh](https://github.com/viperML/nh). Basic install/upgrade commands can be run using `nh`, but more advanced stuff should use `nixos-rebuild`.
|
||||||
|
|
||||||
|
For subsequent builds, you can omit the hostname:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
nh os switch
|
nh os switch
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nix flake update
|
||||||
sudo nixos-rebuild switch --flake .
|
sudo nixos-rebuild switch --flake .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -48,15 +57,7 @@ You can build any Nix or NixOS expression on a remote system before copying it o
|
||||||
nixos-rebuild boot --flake . --build-host haven
|
nixos-rebuild boot --flake . --build-host haven
|
||||||
```
|
```
|
||||||
|
|
||||||
### Upgrading
|
You can also define build targets in a Nix config file. See Dimaga for an example.
|
||||||
|
|
||||||
This config installs a [Nix wrapper called nh](https://github.com/viperML/nh). To use it, run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nh os boot --update
|
|
||||||
```
|
|
||||||
|
|
||||||
You can replace `boot` with `switch`, or add `--ask` to confirm before installing.
|
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
|
|
24
flake.nix
24
flake.nix
|
@ -1,5 +1,5 @@
|
||||||
|
# Based on the Auxolotl template: https://github.com/auxolotl/templates
|
||||||
# For info on Flakes, see: https://nixos-and-flakes.thiscute.world/nixos-with-flakes/nixos-with-flakes-enabled
|
# For info on Flakes, see: https://nixos-and-flakes.thiscute.world/nixos-with-flakes/nixos-with-flakes-enabled
|
||||||
|
|
||||||
{
|
{
|
||||||
description = "Aires' system Flake";
|
description = "Aires' system Flake";
|
||||||
|
|
||||||
|
@ -27,19 +27,18 @@
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, lanzaboote, nix-flatpak, home-manager, nixos-hardware, ... }:
|
outputs = inputs@{ self, nixpkgs, lanzaboote, nix-flatpak, home-manager, nixos-hardware, ... }:
|
||||||
let
|
let
|
||||||
inherit (self) outputs;
|
forAllSystems = function:
|
||||||
inherit (nixpkgs) lib;
|
nixpkgs.lib.genAttrs [
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
"x86_64-linux"
|
||||||
forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys});
|
"aarch64-linux"
|
||||||
pkgsFor = lib.genAttrs systems (system: import nixpkgs {
|
] (system: function nixpkgs.legacyPackages.${system});
|
||||||
inherit system;
|
config.allowUnfree = true;
|
||||||
config.allowUnfree = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
# Define shared modules and imports
|
# Define shared modules and imports
|
||||||
defaultModules = {
|
defaultModules = {
|
||||||
base = [
|
base = [
|
||||||
{ _module.args = { inherit inputs; }; }
|
{ _module.args = { inherit inputs; }; }
|
||||||
|
./hosts/default.nix
|
||||||
lanzaboote.nixosModules.lanzaboote
|
lanzaboote.nixosModules.lanzaboote
|
||||||
nix-flatpak.nixosModules.nix-flatpak
|
nix-flatpak.nixosModules.nix-flatpak
|
||||||
home-manager.nixosModules.home-manager {
|
home-manager.nixosModules.home-manager {
|
||||||
|
@ -57,8 +56,9 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
# Microsoft Surface Laptop Go
|
|
||||||
Dimaga = nixpkgs.lib.nixosSystem {
|
Dimaga = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = defaultModules.base ++ [
|
modules = defaultModules.base ++ [
|
||||||
|
@ -67,7 +67,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Home server
|
|
||||||
Haven = nixpkgs.lib.nixosSystem {
|
Haven = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = defaultModules.base ++ [
|
modules = defaultModules.base ++ [
|
||||||
|
@ -76,7 +75,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Microsoft Surface Pro 9
|
|
||||||
Khanda = nixpkgs.lib.nixosSystem {
|
Khanda = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = defaultModules.base ++ [
|
modules = defaultModules.base ++ [
|
||||||
|
@ -85,7 +83,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Raspberry Pi
|
|
||||||
Pihole = nixpkgs.lib.nixosSystem {
|
Pihole = nixpkgs.lib.nixosSystem {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
modules = defaultModules.base ++ [
|
modules = defaultModules.base ++ [
|
||||||
|
@ -94,7 +91,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Lenovo Legion Slim 7 Gen 7 AMD
|
|
||||||
Shura = nixpkgs.lib.nixosSystem {
|
Shura = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = defaultModules.base ++ [
|
modules = defaultModules.base ++ [
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }: {
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
# Settings specific to Dimaga
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../common
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
@ -17,7 +10,7 @@
|
||||||
kdeconnect.enable = true;
|
kdeconnect.enable = true;
|
||||||
media.enable = true;
|
media.enable = true;
|
||||||
office.enable = true;
|
office.enable = true;
|
||||||
pandoc.enable = true;
|
writing.enable = true;
|
||||||
};
|
};
|
||||||
ui = {
|
ui = {
|
||||||
flatpak.enable = true;
|
flatpak.enable = true;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# Surface Laptop Go
|
# Surface Laptop Go 1st gen
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }: {
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
{ pkgs, home-manager, lib, config, ... }:
|
{ pkgs, home-manager, lib, config, ... }:
|
||||||
|
|
||||||
# Settings specific to Haven
|
|
||||||
|
|
||||||
let
|
let
|
||||||
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
|
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./hardware-configuration.nix ];
|
||||||
./hardware-configuration.nix
|
|
||||||
../common
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
system.autoUpgrade.enable = lib.mkForce false;
|
system.autoUpgrade.enable = lib.mkForce false;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
# Minisforum UM340
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }: {
|
||||||
{
|
|
||||||
imports =
|
imports =
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix") ];
|
[ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }: {
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
# Settings specific to Dimaga
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../common
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
system.autoUpgrade.enable = lib.mkForce false;
|
system.autoUpgrade.enable = lib.mkForce false;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# Surface Pro 9
|
# Surface Pro 9
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }: {
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }: {
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
# Settings specific to Raspberry Pi 4b
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../common
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Raspberry Pi 4
|
# Raspberry Pi 4B
|
||||||
# See https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4
|
# See https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4
|
||||||
{ config, lib, pkgs, modulesPath, nixos-hardware, ... }:
|
{ config, lib, pkgs, modulesPath, nixos-hardware, ... }:
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
# Configuration options unique to Shura
|
|
||||||
|
|
||||||
let
|
let
|
||||||
# Copy bluetooth device configs
|
# Copy bluetooth device configs
|
||||||
shure-aonic-bluetooth = pkgs.writeText "info" (builtins.readFile ./bluetooth/shure-aonic-bluetooth-params);
|
shure-aonic-bluetooth = pkgs.writeText "info" (builtins.readFile ./bluetooth/shure-aonic-bluetooth-params);
|
||||||
|
@ -13,10 +10,7 @@ let
|
||||||
monitorsConfig = pkgs.writeText "gdm_monitors.xml" monitorsXmlContent;
|
monitorsConfig = pkgs.writeText "gdm_monitors.xml" monitorsXmlContent;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./hardware-configuration.nix ];
|
||||||
./hardware-configuration.nix
|
|
||||||
../common
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# Lenovo Legion S7 16ARHA7 configuration
|
# Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7)
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }: {
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
let
|
|
||||||
# Fetch secrets
|
|
||||||
# IMPORTANT: Make sure this repo exists on the filesystem first!
|
|
||||||
nix-secrets = builtins.fetchGit {
|
|
||||||
url = "/home/aires/Development/nix-configuration/nix-secrets";
|
|
||||||
ref = "main";
|
|
||||||
rev = "55fc814d477d956ab885e157f24c2d43f433dc7a";
|
|
||||||
};
|
|
||||||
in{
|
|
||||||
imports = [
|
|
||||||
../../modules
|
|
||||||
"${nix-secrets}/default.nix"
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,9 +1,15 @@
|
||||||
{ ... }: {
|
{ lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
# Fetch secrets
|
||||||
|
# IMPORTANT: Make sure this repo exists on the filesystem first!
|
||||||
|
nix-secrets = builtins.fetchGit {
|
||||||
|
url = "/home/aires/Development/nix-configuration/nix-secrets";
|
||||||
|
ref = "main";
|
||||||
|
rev = "55fc814d477d956ab885e157f24c2d43f433dc7a";
|
||||||
|
};
|
||||||
|
in{
|
||||||
imports = [
|
imports = [
|
||||||
./Dimaga
|
"${nix-secrets}/default.nix"
|
||||||
./Haven
|
../modules
|
||||||
./Khanda
|
|
||||||
./Pihole
|
|
||||||
./Shura
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue