adding modularity
This commit is contained in:
parent
166bed403e
commit
65f0d10809
17
README.md
17
README.md
@ -1,2 +1,19 @@
|
|||||||
# NixOS configuration - managing my devices
|
# NixOS configuration - managing my devices
|
||||||
|
|
||||||
|
|
||||||
|
## Using this flake
|
||||||
|
Clone this repository and use the current directory as the flake target `<target>`.
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
Use this repository as a a remote input using the following format for `<target>`:
|
||||||
|
```
|
||||||
|
git+https://git.kluster.moll.re/remoll/nixos-config
|
||||||
|
```
|
||||||
|
Don't forget to add the `#<host>` to the end of the target to specify the host configuration to use.
|
||||||
|
|
||||||
|
|
||||||
|
## Hosts
|
||||||
|
|
||||||
|
### Spectre
|
||||||
|
Run `nixos-rebuild switch --flake <target>#spectre` to apply the configuration.
|
||||||
|
66
flake.lock
generated
Normal file
66
flake.lock
generated
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720042825,
|
||||||
|
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "release-24.05",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724531977,
|
||||||
|
"narHash": "sha256-XROVLf9ti4rrNCFLr+DmXRZtPjCQTW4cYy59owTEmxk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2527da1ef492c495d5391f3bcf9c1dd9f4514e32",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-unstable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724479785,
|
||||||
|
"narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
33
flake.nix
33
flake.nix
@ -4,16 +4,41 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
# probably home manager at some point
|
# Home manager
|
||||||
|
home-manager.url = "github:nix-community/home-manager/release-24.05";
|
||||||
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }@inputs: {
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
home-manager,
|
||||||
|
...
|
||||||
|
} @ inputs: {
|
||||||
|
|
||||||
nixosConfigurations.spectre-x360-2018 = nixpkgs.lib.nixosSystem {
|
nixosConfigurations = {
|
||||||
|
# HP Spectre x360 2018
|
||||||
|
spectre = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
./machines/spectre-x360-2018/configuration.nix
|
./hosts/spectre-x360-2018/configuration.nix
|
||||||
|
./modules/nixos/gdm.nix
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
# home-manager.extraSpecialArgs = inputs // specialArgs;
|
||||||
|
home-manager.users.remy = import ./users/remy.nix;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
# raspberry-pi = nixpkgs.lib.nixosSystem {
|
||||||
|
# system = "aarch64-linux";
|
||||||
|
# modules = [
|
||||||
|
# ./hosts/raspberry-pi/configuration.nix
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,25 @@
|
|||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Use the "experimental" flakes for cleaner config
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
# Use the systemd-boot EFI boot loader.
|
# Use the systemd-boot EFI boot loader.
|
||||||
|
# In this setup it is chain-loaded by REFInd (managed by Arch linux)
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = false;
|
boot.loader.efi.canTouchEfiVariables = false;
|
||||||
|
|
||||||
|
# require the bcachefs modules to be loaded
|
||||||
boot.supportedFilesystems = [ "bcachefs" ];
|
boot.supportedFilesystems = [ "bcachefs" ];
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
networking.hostName = "nixos"; # Define your hostname.
|
networking.hostName = "ArchNix"; # Define your hostname.
|
||||||
# Pick only one of the below networking options.
|
# Pick only one of the below networking options.
|
||||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||||
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Europe/Amsterdam";
|
time.timeZone = "Europe/Berlin";
|
||||||
|
|
||||||
# Configure network proxy if necessary
|
# Configure network proxy if necessary
|
||||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
0
modules/home-manager/browser.nix
Normal file
0
modules/home-manager/browser.nix
Normal file
0
modules/home-manager/code.nix
Normal file
0
modules/home-manager/code.nix
Normal file
26
modules/nixos/gdm.nix
Normal file
26
modules/nixos/gdm.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
# this actually does not enable xorg, but it is required for GDM
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.xserver.displayManager.gdm.enable = true;
|
||||||
|
services.xserver.desktopManager.gnome.enable = true;
|
||||||
|
# here we set wayland to be used
|
||||||
|
services.xserver.displayManager.gdm.wayland = true;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
services.gdm = {
|
||||||
|
enable = lib.mkEnableOption "Enable GDM";
|
||||||
|
# Add any additional GDM options here
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
services.gdm = if config.services.gdm.enable then gdmConfig else {};
|
||||||
|
};
|
||||||
|
}
|
26
modules/nixos/networks.nix
Normal file
26
modules/nixos/networks.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
networks = [
|
||||||
|
{
|
||||||
|
ssid = "MyNetwork1";
|
||||||
|
psk = "password1";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ssid = "MyNetwork2";
|
||||||
|
psk = "password2";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ssid = "MyNetwork3";
|
||||||
|
psk = "password3";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ssid = "MyNetwork4";
|
||||||
|
psk = "password4";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
networking.networkmanager.networks = networks;
|
||||||
|
}
|
12
users/remy.nix
Normal file
12
users/remy.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
../modules/home-manager/browser.nix
|
||||||
|
../modules/home-manager/code.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.git = {
|
||||||
|
userName = "Remy Moll";
|
||||||
|
userEmail = "me@moll.re";
|
||||||
|
};
|
||||||
|
}
|
22
utils/binary-cache.nix
Normal file
22
utils/binary-cache.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
|
||||||
|
# ...
|
||||||
|
nix.settings = {
|
||||||
|
# allow substituters to be used
|
||||||
|
|
||||||
|
substituters = [
|
||||||
|
# also add mirrors?
|
||||||
|
# "https://mirrors.ustc.edu.cn/nix-channels/store"
|
||||||
|
"https://cache.nixos.org"
|
||||||
|
];
|
||||||
|
|
||||||
|
trusted-public-keys = [
|
||||||
|
# the default public key of cache.nixos.org, it's built-in, no need to add it here
|
||||||
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
23
utils/garbage-collection.nix
Normal file
23
utils/garbage-collection.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# ...
|
||||||
|
|
||||||
|
# Limit the number of generations to keep
|
||||||
|
boot.loader.systemd-boot.configurationLimit = 10;
|
||||||
|
# boot.loader.grub.configurationLimit = 10;
|
||||||
|
|
||||||
|
# Perform garbage collection weekly to maintain low disk usage
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 1w";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optimize storage
|
||||||
|
# You can also manually optimize the store via:
|
||||||
|
# nix-store --optimise
|
||||||
|
# Refer to the following link for more details:
|
||||||
|
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
|
||||||
|
nix.settings.auto-optimise-store = true;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user