modularise a bit
This commit is contained in:
parent
e871ce10c7
commit
f96e27fecd
5 changed files with 44 additions and 67 deletions
21
flake.nix
21
flake.nix
|
|
@ -10,29 +10,16 @@
|
||||||
outputs = { nixpkgs, home-manager, ... }:
|
outputs = { nixpkgs, home-manager, ... }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
|
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
mkConf = import ./lib/mkconf.nix;
|
||||||
|
|
||||||
|
user = "tristan";
|
||||||
in {
|
in {
|
||||||
|
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
zenix = lib.nixosSystem {
|
zenix = mkConf "zenix" { inherit nixpkgs system user home-manager; };
|
||||||
inherit system;
|
|
||||||
|
|
||||||
modules = [
|
|
||||||
./system/configuration.nix
|
|
||||||
home-manager.nixosModules.home-manager {
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
home-manager.users.tristan = {
|
|
||||||
imports = [ ./home.nix ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,22 @@
|
||||||
# Edit this configuration file to define what should be installed on
|
|
||||||
# your system. Help is available in the configuration.nix(5) man page
|
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
||||||
|
|
||||||
# https://search.nixos.org/options
|
# https://search.nixos.org/options
|
||||||
|
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.trusted-users = [ "root" "tristan" ];
|
nix.settings.trusted-users = [ "root" "tristan" ];
|
||||||
|
|
||||||
# Use the systemd-boot EFI boot loader.
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
# boot.loader.grub.enable = true;
|
|
||||||
# boot.loader.grub.version = 2;
|
|
||||||
# boot.loader.grub.devices = ["nodev"];
|
|
||||||
# boot.loader.grub.useOSProber = true;
|
|
||||||
# boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "zenix";
|
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
time.timeZone = "Europe/London";
|
time.timeZone = "Europe/London";
|
||||||
|
|
||||||
i18n.defaultLocale = "en_GB.UTF-8";
|
|
||||||
console = {
|
|
||||||
font = "Lat2-Terminus16";
|
|
||||||
};
|
|
||||||
|
|
||||||
# use pipewire
|
# use pipewire
|
||||||
hardware.pulseaudio.enable = false;
|
hardware.pulseaudio.enable = false;
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
|
|
@ -158,35 +138,5 @@
|
||||||
bind-key -T copy-mode-vi y send-keys -X copy-selection
|
bind-key -T copy-mode-vi y send-keys -X copy-selection
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
# programs.gnupg.agent = {
|
|
||||||
# enable = true;
|
|
||||||
# enableSSHSupport = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# List services that you want to enable:
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
services.openssh.enable = true;
|
|
||||||
|
|
||||||
services.tailscale.enable = true;
|
|
||||||
|
|
||||||
# Open ports in the firewall.
|
|
||||||
networking.firewall.allowedTCPPorts = [ ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
# networking.firewall.enable = false;
|
|
||||||
|
|
||||||
networking.firewall.checkReversePath = "loose";
|
|
||||||
|
|
||||||
# Copy the NixOS configuration file and link it from the resulting system
|
|
||||||
# (/run/current-system/configuration.nix). This is useful in case you
|
|
||||||
# accidentally delete configuration.nix.
|
|
||||||
# system.copySystemConfiguration = true;
|
|
||||||
|
|
||||||
system.stateVersion = "22.11"; # Did you read the comment?
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
17
lib/mkconf.nix
Normal file
17
lib/mkconf.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
name: { nixpkgs, home-manager, system, user, ... }:
|
||||||
|
|
||||||
|
nixpkgs.lib.nixosSystem rec {
|
||||||
|
inherit system;
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
|
||||||
|
../hardware/${name}.nix
|
||||||
|
../system/${name}.nix
|
||||||
|
../global.nix
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.${user} = import ../home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
23
system/zenix.nix
Normal file
23
system/zenix.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# https://search.nixos.org/options
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
networking.hostName = "zenix";
|
||||||
|
|
||||||
|
i18n.defaultLocale = "en_GB.UTF-8";
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
services.tailscale.enable = true;
|
||||||
|
networking.firewall.checkReversePath = "loose";
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ ];
|
||||||
|
|
||||||
|
system.stateVersion = "22.11"; # do not change
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue