From 093cb612282f48d15ba295f109660e47a22f8e39 Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sat, 18 Feb 2023 14:31:33 +0100 Subject: factor out common configuration options --- config/boot.nix | 10 ++-------- config/default.nix | 4 ++-- config/environment.nix | 13 ++++--------- config/hardware-configuration.nix | 27 +++++++++++++++++++++++++++ config/networking.nix | 21 ++++++--------------- config/nix.nix | 12 ++++++++++++ config/store.nix | 21 --------------------- config/users.nix | 8 +------- 8 files changed, 54 insertions(+), 62 deletions(-) create mode 100644 config/hardware-configuration.nix create mode 100644 config/nix.nix delete mode 100644 config/store.nix (limited to 'config') diff --git a/config/boot.nix b/config/boot.nix index df60fea..910e251 100644 --- a/config/boot.nix +++ b/config/boot.nix @@ -1,12 +1,6 @@ { ... }: { - boot = { - loader.grub = { - enable = true; - version = 2; - enableCryptodisk = true; - device = "/dev/vda"; - }; - }; + personal.boot.grub.enable = true; + boot.loader.grub.device = "/dev/vda"; } diff --git a/config/default.nix b/config/default.nix index 271ee4b..43dff7d 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,4 +1,4 @@ -{ pkgs, modulesPath, ... }: +{ modulesPath, ... }: { imports = [ @@ -7,8 +7,8 @@ ./boot.nix ./environment.nix ./networking.nix + ./nix.nix ./services - ./store.nix ./users.nix ]; diff --git a/config/environment.nix b/config/environment.nix index e812e43..61f55ff 100644 --- a/config/environment.nix +++ b/config/environment.nix @@ -1,16 +1,11 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ vim gitMinimal ]; + personal.environment = { + enable = true; + locale.enable = true; + }; programs.bash.promptInit = '' PS1="\n\[\033[1;32m\][\[\e]0;\u@$(hostname -f): \w\a\]\u@$(hostname -f):\w]\$\[\033[0m\] " ''; - - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "fr"; - }; - - time.timeZone = "Europe/Paris"; } diff --git a/config/hardware-configuration.nix b/config/hardware-configuration.nix new file mode 100644 index 0000000..1b79e6f --- /dev/null +++ b/config/hardware-configuration.nix @@ -0,0 +1,27 @@ +{ pkgs, lib, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = + [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/2b302948-5608-41c6-b54c-1c0e39ff6a58"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."root".device = + "/dev/disk/by-uuid/eaec758b-ba22-42ab-8992-e765cec9be55"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/74d78eba-c29a-4724-8fb7-624e0a03faa5"; + fsType = "ext4"; + }; + + swapDevices = [{ device = "/swap"; }]; + +} diff --git a/config/networking.nix b/config/networking.nix index decd84e..172834d 100644 --- a/config/networking.nix +++ b/config/networking.nix @@ -1,6 +1,12 @@ { pkgs, ... }: { + personal.networking = { + enable = true; + firewall.http = true; + ssh.enable = true; + }; + networking = { hostName = "hermes"; domain = "aristote.fr"; @@ -12,20 +18,5 @@ }]; defaultGateway = "93.95.228.1"; nameservers = [ "93.95.224.28" "93.95.224.29" ]; - - firewall = { - enable = true; - allowedTCPPorts = [ 80 443 ]; - }; - }; - - services.openssh = { - enable = true; - permitRootLogin = "no"; - passwordAuthentication = false; - extraConfig = '' - AcceptEnv PS1 - ''; }; - services.fail2ban.enable = true; } diff --git a/config/nix.nix b/config/nix.nix new file mode 100644 index 0000000..5c9278f --- /dev/null +++ b/config/nix.nix @@ -0,0 +1,12 @@ +{ lib, ... }: + +{ + personal.nix = { + enable = true; + autoUpgrade = true; + gc.enable = true; + flake = "git+file:///etc/nixos/"; + }; + nix.settings.max-jobs = lib.mkDefault 1; + system.autoUpgrade.flags = [ "--update-input" "personal-webpage/data" ]; +} diff --git a/config/store.nix b/config/store.nix deleted file mode 100644 index 8efcd5d..0000000 --- a/config/store.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, ... }: - -{ - nix = { - settings = { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - }; - gc = { - automatic = true; - dates = "daily"; - options = "--delete-old"; - }; - settings.max-jobs = lib.mkDefault 1; - }; - system.autoUpgrade = { - enable = true; - flake = "git+file:///etc/nixos/"; - flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; - }; -} diff --git a/config/users.nix b/config/users.nix index 99a497d..36aacef 100644 --- a/config/users.nix +++ b/config/users.nix @@ -1,11 +1,5 @@ { ... }: { - users.users.qaristote = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK4wGbl3++lqCjLUhoRyABBrVEeNhIXYO4371srkRoyq qaristote@latitude-7490" - ]; - }; + personal.user.enable = true; } -- cgit v1.3.1 From 7532f335a3ed8a898e2df95f06faa38bad2b8e5d Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sun, 19 Feb 2023 16:44:12 +0100 Subject: rollback to nixos-stable (fix ihatemoney and searx) --- config/services/web/searx/searx/engines.nix | 2 +- flake.lock | 37 ++++++++++++++++++++++------- flake.nix | 8 +++++-- 3 files changed, 35 insertions(+), 12 deletions(-) (limited to 'config') diff --git a/config/services/web/searx/searx/engines.nix b/config/services/web/searx/searx/engines.nix index 259ea74..1c5273a 100644 --- a/config/services/web/searx/searx/engines.nix +++ b/config/services/web/searx/searx/engines.nix @@ -54,7 +54,7 @@ in { # files "btdigg" # images - "openverse" + "ccengine" "bing images" "library of congress" "qwant images" diff --git a/flake.lock b/flake.lock index 543792b..ead2bbd 100644 --- a/flake.lock +++ b/flake.lock @@ -45,7 +45,7 @@ }, "locked": { "lastModified": 1676671024, - "narHash": "sha256-hziJ8MYh4f27DAaVjWqqZd0gC9LFIMx5ADnXik5+1HI=", + "narHash": "sha256-Duxvn4bUTG0n03KO3cxvqThtEk1e6FfLdGXJLKrOV8c=", "type": "git", "url": "file:///home/qaristote/code/nix/my-nixpkgs" }, @@ -56,25 +56,43 @@ }, "nixpkgs": { "locked": { - "lastModified": 1676549890, - "narHash": "sha256-sq/WcOEAl7gWrrfGkWdnyYazRyTf+enEim/o6LOQzI8=", + "lastModified": 1676771332, + "narHash": "sha256-YYn2K0AwyIyCzvP7C+xzEt64rlCRPyrllRPGNNu+50M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8c66bd1b68f4708c90dcc97c6f7052a5a7b33257", + "rev": "f27a4e2f6a3a23b843ca1c736e6043fb8b99acc1", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-22.11-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1676795730, + "narHash": "sha256-X69A9BdcPTySJJ7DqS4wc8b6eqGKi32jCSyaBsz4WB0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "efc59894b1ba73cb745676616c56c780383d6788", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" } }, "nur": { "locked": { - "lastModified": 1676725308, - "narHash": "sha256-vzS7PJCDD7fCA9ybuiNcQgOAploV++zF//j6WL2e7zA=", + "lastModified": 1676817898, + "narHash": "sha256-1yrNakg2qtOI9v/IFk+cYPEYtuoOQTsRvjG88tlhAVo=", "owner": "nix-community", "repo": "NUR", - "rev": "ec4bf914ab48fef81ad0ff0cbc70c84895454e0e", + "rev": "241b6ab4dccc162906a265e421a537847b74e8e9", "type": "github" }, "original": { @@ -109,6 +127,7 @@ "inputs": { "my-nixpkgs": "my-nixpkgs", "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", "personal-webpage": "personal-webpage" } }, diff --git a/flake.nix b/flake.nix index 165e627..3541de1 100644 --- a/flake.nix +++ b/flake.nix @@ -5,16 +5,20 @@ inputs.nixpkgs.follows = "/nixpkgs"; }; my-nixpkgs.url = "git+file:///home/qaristote/code/nix/my-nixpkgs"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11-small"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small"; }; - outputs = { self, nixpkgs, my-nixpkgs, personal-webpage, ... }: { + outputs = { self, nixpkgs, nixpkgs-unstable, my-nixpkgs, personal-webpage, ... }: { nixosConfigurations = let system = "x86_64-linux"; commonModules = [ my-nixpkgs.nixosModules.personal ({ ... }: { nixpkgs.overlays = - [ my-nixpkgs.overlays.personal personal-webpage.overlays.default ]; + [ my-nixpkgs.overlays.personal personal-webpage.overlays.default (_: prev: { + inherit (nixpkgs-unstable.legacyPackages."${prev.system}") filtron; + })]; }) ]; in { -- cgit v1.3.1