From cb788261448f0cc1aff6bf6505f5b6bcd7a17531 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 10 Feb 2022 18:13:41 -0800 Subject: nix: fix a bunch of stuff --- flake.nix | 7 +++++-- hosts/carmel/configuration.nix | 44 ------------------------------------------ hosts/carmel/default.nix | 43 +++++++++++++++++++++++++++++++++++++++++ lib/default.nix | 14 +++++--------- 4 files changed, 53 insertions(+), 55 deletions(-) delete mode 100644 hosts/carmel/configuration.nix create mode 100644 hosts/carmel/default.nix diff --git a/flake.nix b/flake.nix index e792668..bd68281 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,12 @@ { description = "personal NixOS configurations"; + inputs = { # Nixpkgs, NixOS's official repo nixpkgs.url = "github:nixos/nixpkgs/release-21.11"; + utils.url = "github:numtide/flake-utils"; + # We use the unstable nixpkgs repo for some packages. nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; @@ -18,7 +21,7 @@ outputs = { ... }@inputs: let lib = import ./lib { inherit inputs; }; - in: { + in { nixosConfigurations = { carmel = lib.mkSystem { hostname = "carmel"; @@ -37,7 +40,7 @@ }; } // inputs.utils.lib.eachDefaultSystem (system: let - pkgs = import inputs.nixpkgs { inherit system overlays; }; + pkgs = import inputs.nixpkgs { inherit system; }; home-manager = inputs.home-manager.defaultPackage."${system}"; in { diff --git a/hosts/carmel/configuration.nix b/hosts/carmel/configuration.nix deleted file mode 100644 index d009831..0000000 --- a/hosts/carmel/configuration.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../../modules/systems - ../../modules/desktop - ]; - - nix = { - package = pkgs.nixUnstable; - }; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - time.timeZone = "America/Los_Angeles"; - - networking.hostName = "carmel"; # Define your hostname. - - networking.wireless.enable = false; - networking.interfaces.enp9s0.useDHCP = true; - networking.interfaces.wlp8s0.useDHCP = true; - # TODO: If set to false, systemd hangs on boot, unclear why. - - services.xserver.dpi = 168; - - # Use systemd-resolved - services.resolved = { - enable = true; - dnssec = "false"; - }; - - # 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. It‘s 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 = "21.11"; # Did you read the comment? -} - diff --git a/hosts/carmel/default.nix b/hosts/carmel/default.nix new file mode 100644 index 0000000..19c88c0 --- /dev/null +++ b/hosts/carmel/default.nix @@ -0,0 +1,43 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../modules/desktop + ]; + + nix = { + package = pkgs.nixUnstable; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + time.timeZone = "America/Los_Angeles"; + + networking.hostName = "carmel"; # Define your hostname. + + networking.wireless.enable = false; + networking.interfaces.enp9s0.useDHCP = true; + networking.interfaces.wlp8s0.useDHCP = true; + # TODO: If set to false, systemd hangs on boot, unclear why. + + services.xserver.dpi = 168; + + # Use systemd-resolved + services.resolved = { + enable = true; + dnssec = "false"; + }; + + # 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. It‘s 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 = "21.11"; # Did you read the comment? +} + diff --git a/lib/default.nix b/lib/default.nix index 7f0f8ed..532a33b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,24 +1,21 @@ -{ inputs, overlays }: +{ inputs }: + { mkSystem = { hostname , system - , desktop ? false }: inputs.nixpkgs.lib.nixosSystem { inherit system; specialArgs = { - inherit inputs system hostname desktop; + inherit inputs system hostname; }; modules = [ - ../modules/deskop ../modules/system ../hosts/${hostname} { networking.hostName = hostname; - # Apply overlay and allow unfree packages nixpkgs = { - inherit overlays; config.allowUnfree = true; }; # Add each input as a registry @@ -27,7 +24,7 @@ inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) inputs; } - ] + ]; }; mkHome = @@ -39,7 +36,7 @@ inputs.home-manager.lib.homeManagerConfiguration { inherit username system; extraSpecialArgs = { - inherit system hostname graphical; + inherit system hostname desktop; }; homeDirectory = "/home/${username}"; configuration = ../users/${username}; @@ -48,7 +45,6 @@ # Base configuration { nixpkgs = { - inherit overlays; config.allowUnfree = true; }; programs = { -- cgit 1.4.1