seperate hosts in each file

This commit is contained in:
Ranomier 2024-09-29 12:05:41 +02:00
parent 2597fc7fb8
commit 6e143facef
7 changed files with 168 additions and 144 deletions

23
default.nix Normal file
View file

@ -0,0 +1,23 @@
# This file defines overlays
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs final.pkgs;
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}

30
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1726592409, "lastModified": 1726989464,
"narHash": "sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U=", "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594", "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -38,25 +38,27 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1726489388, "lastModified": 1727437159,
"narHash": "sha256-JBHtN+n1HzKawpnOQAz6jdgvrtYV9c/kyzgoIdguQGo=", "narHash": "sha256-v4qLwEw5OmprgQZTT7KZMNU7JjXJzRypw8+Cw6++fWk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "dc8b0296f68f72f3fe77469c549a6f098555c2e9", "rev": "d830ad47cc992b4a46b342bbc79694cbd0e980b2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixos-hardware", "owner": "NixOS",
"type": "indirect" "ref": "master",
"repo": "nixos-hardware",
"type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726447378, "lastModified": 1727264057,
"narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", "narHash": "sha256-KQPI8CTTnB9CrJ7LrmLC4VWbKZfljEPBXOFGZFRpxao=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", "rev": "759537f06e6999e141588ff1c9be7f3a5c060106",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,11 +70,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1726463316, "lastModified": 1727348695,
"narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
"type": "github" "type": "github"
}, },
"original": { "original": {

117
flake.nix
View file

@ -11,7 +11,7 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
# ready made hardware configurations. e.G.: Power saving # ready made hardware configurations. e.G.: Power saving
#nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# NixOS unstable channel # NixOS unstable channel
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -30,77 +30,58 @@
####### #######
outputs = outputs =
####### #######
{ self, nixpkgs, nixos-hardware, nixpkgs-unstable, nix-flatpak, home-manager, ... }: let { self, nixpkgs, nixos-hardware, nixpkgs-unstable, nix-flatpak, home-manager, ... } @ inputs:
overlays = { let
unstable-packages = final: prev: { # Supported systems for your flake packages, shell, etc.
unstable = import nixpkgs-unstable { systems = [
system = "x86_64-linux"; "aarch64-linux"
config.allowUnfree = true; "x86_64-linux"
}; ];
}; # This is a function that generates an attribute by calling a function you
}; # pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
in { in {
# NOTE: 'nixos' is the default hostname set by the installer # Your custom packages
nixosConfigurations.crocoite = nixpkgs.lib.nixosSystem { # Accessible through 'nix build', 'nix shell', etc
#packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
#formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# FIXME replace with your hostname
crocoite = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [ modules = [
( let # > Our main nixos configuration file <
pkgs2 = nixpkgs.legacyPackages."x86_64-linux"; ./hosts/crocoite.nix
in
{
nixpkgs.overlays = [ overlays.unstable-packages ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager,
# focused on correctness, usability, and growth
# and committed to doing right by its community.
nix.package = pkgs2.lix;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
})
nix-flatpak.nixosModules.nix-flatpak
./hardware-configuration.nix
#nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
./modules/basic_system_config.nix
./modules/networking.nix
./modules/boot_theming.nix
./modules/specific_hardware/scan_and_print.nix
./modules/specific_hardware/fwupd.nix
./modules/specific_hardware/bluetooth.nix
./modules/sec_auth/firejail.nix
./modules/sec_auth/login-manager.nix
./modules/sec_auth/users_and_permissions.nix
./modules/sec_auth/ssh.nix
./modules/software/software.nix
./modules/software/game.nix
./modules/software/audio_video.nix
./modules/software/obs-studio.nix
./modules/wm_and_de/hyprland.nix
./modules/pkg_mgrmnt/flatpak.nix
./modules/pkg_mgrmnt/podman.nix
./modules/pkg_mgrmnt/store_pkg_file.nix
./modules/software/nix-helper/index.nix
./modules/software/nix-helper/doc.nix
./modules/software/nix-helper/nix-ld.nix
./modules/software/browser/firefox.nix
./modules/software/browser/brave.nix
]; ];
}; };
}; };
## Standalone home-manager configuration entrypoint
## Available through 'home-manager --flake .#your-username@your-hostname'
#homeConfigurations = {
# # FIXME replace with your username@hostname
# "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs;};
# modules = [
# # > Our main home-manager configuration file <
# ./home-manager/home.nix
# ];
# };
#};
};
} }

View file

@ -1,23 +1,6 @@
{ ... }: { { pkgs, overlays, inputs, ... }: {
#MANPAGER='nvim +Man!' #MANPAGER='nvim +Man!'
# Allow unfree packages
#unstable.config.allowUnfree = true;
{ nixpkgs.config.allowUnfree = true; }
( let
pkgs2 = nixpkgs.legacyPackages."x86_64-linux";
in
{
nixpkgs.overlays = [ overlays.unstable-packages ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager,
# focused on correctness, usability, and growth
# and committed to doing right by its community.
nix.package = pkgs2.lix;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
@ -25,40 +8,54 @@
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
})
nix-flatpak.nixosModules.nix-flatpak
./hardware-configuration.nix # Allow unfree packages
#unstable.config.allowUnfree = true;
nixpkgs.config.allowUnfree = true;
#nixpkgs.overlays = [ overlays.unstable-packages ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager,
# focused on correctness, usability, and growth
# and committed to doing right by its community.
nix.package = pkgs.lix;
imports = [
inputs.nix-flatpak.nixosModules.nix-flatpak
#nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 #nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
../hardware-configuration.nix
./modules/basic_system_config.nix ../modules/basic_system_config.nix
./modules/networking.nix ../modules/networking.nix
./modules/boot_theming.nix ../modules/boot_theming.nix
./modules/specific_hardware/scan_and_print.nix ../modules/specific_hardware/scan_and_print.nix
./modules/specific_hardware/fwupd.nix ../modules/specific_hardware/fwupd.nix
./modules/specific_hardware/bluetooth.nix ../modules/specific_hardware/bluetooth.nix
./modules/sec_auth/firejail.nix ../modules/sec_auth/firejail.nix
./modules/sec_auth/login-manager.nix ../modules/sec_auth/login-manager.nix
./modules/sec_auth/users_and_permissions.nix ../modules/sec_auth/users_and_permissions.nix
./modules/sec_auth/ssh.nix ../modules/sec_auth/ssh.nix
./modules/software/software.nix ../modules/software/software.nix
./modules/software/game.nix ../modules/software/game.nix
./modules/software/audio_video.nix ../modules/software/audio_video.nix
./modules/software/obs-studio.nix ../modules/software/obs-studio.nix
./modules/wm_and_de/hyprland.nix ../modules/wm_and_de/hyprland.nix
./modules/pkg_mgrmnt/flatpak.nix ../modules/pkg_mgrmnt/flatpak.nix
./modules/pkg_mgrmnt/podman.nix ../modules/pkg_mgrmnt/podman.nix
./modules/pkg_mgrmnt/store_pkg_file.nix ../modules/pkg_mgrmnt/store_pkg_file.nix
./modules/software/nix-helper/index.nix ../modules/software/nix-helper/index.nix
./modules/software/nix-helper/doc.nix ../modules/software/nix-helper/doc.nix
./modules/software/nix-helper/nix-ld.nix ../modules/software/nix-helper/nix-ld.nix
./modules/software/browser/firefox.nix ../modules/software/browser/firefox.nix
./modules/software/browser/brave.nix ../modules/software/browser/brave.nix
];
} }

View file

@ -1,6 +1,4 @@
# TODO refine firejail it seems that / is not shielded enough and app armor does not work # TODO refine firejail it seems that / is not shielded enough and app armor does not work
{ pkgs, ... }: { pkgs, ... }:
{ {
programs.firejail = { programs.firejail = {

View file

@ -1,8 +1,6 @@
{ pkgs, ... }: { { pkgs, inputs, config, ... }: let
# Allow unfree packages unstable_list = [ inputs.nixpkgs-unstable.legacyPackages."x86_64-linux".neovim ];
#unstable.config.allowUnfree = true; in {
nixpkgs.config.allowUnfree = true;
# also opens the TCP and UDP port from 1714 to 1764 # also opens the TCP and UDP port from 1714 to 1764
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
@ -39,7 +37,7 @@
lm_sensors lm_sensors
# neovim # neovim
unstable.neovim # unstable.neovim
git git
gnumake gnumake
gcc gcc
@ -74,7 +72,9 @@
keepassxc keepassxc
#minecraft #minecraft
element-desktop element-desktop
]; ] ++ unstable_list;
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
noto-fonts noto-fonts
noto-fonts-cjk noto-fonts-cjk

23
overlays/default.nix Normal file
View file

@ -0,0 +1,23 @@
# This file defines overlays
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs final.pkgs;
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}