From 56c6847439a7e54691fb49f8137590bc8ac1d7e4 Mon Sep 17 00:00:00 2001 From: pegasust Date: Sun, 6 Nov 2022 11:48:16 +0000 Subject: [PATCH] fix: apply-system.sh now uses flake --- apply-system.sh | 2 +- devel/flake.nix | 30 ++++++++++++++ system/configuration.nix | 15 +------ system/hardware-configuration.nix | 65 +++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 devel/flake.nix create mode 100644 system/hardware-configuration.nix diff --git a/apply-system.sh b/apply-system.sh index 8f65bd3..7175470 100755 --- a/apply-system.sh +++ b/apply-system.sh @@ -18,5 +18,5 @@ ln -s -T ${SCRIPT_DIR} ${CONFIG_DIR} # $PWD to ~/.dotfiles pushd ~/.dotfiles -sudo nixos-rebuild switch -I nixos-config=./system/configuration.nix +sudo nixos-rebuild switch --flake ./system#nixos popd diff --git a/devel/flake.nix b/devel/flake.nix new file mode 100644 index 0000000..c199a94 --- /dev/null +++ b/devel/flake.nix @@ -0,0 +1,30 @@ +{ + description = "My development flake"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils, ... }: { + programs.neovim = { + enable = true; + defaultEditor = true; + }; + programs.git = { + enable = true; + }; + programs.zsh = { + enable = true; + shellAliases = { + # list lists + ll = "ls -l"; + update = "sudo nixos-rebuild switch"; + }; + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + }; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix index e298cb6..891e552 100755 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -11,7 +11,6 @@ in nixos-wsl.nixosModules.wsl ]; - networking.hostName = "nixos"; system.stateVersion = "22.05"; wsl = { @@ -28,6 +27,7 @@ in }; # users.users..uid = 1000; + networking.hostName = "nixos"; # Enable nix flakes nix.package = pkgs.nixFlakes; @@ -44,19 +44,6 @@ in enable = true; # more information should be configured under user level }; - programs.zsh = { - enable = true; - shellAliases = { - # list lists - ll = "ls -l"; - update = "sudo nixos-rebuild switch"; - }; - history = { - size = 10000; - path = "${config.xdg.dataHome}/zsh/history"; - }; - }; - environment.systemPackages = [ pkgs.gnumake ]; diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100644 index 0000000..bd15e46 --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,65 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ ]; + + boot.initrd.availableKernelModules = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/sdd"; + fsType = "ext4"; + }; + + fileSystems."/usr/lib/wsl/drivers" = + { device = "drivers"; + fsType = "9p"; + }; + + fileSystems."/usr/lib/wsl/lib" = + { device = "lib"; + fsType = "9p"; + }; + + fileSystems."/mnt/wsl" = + { device = "tmpfs"; + fsType = "tmpfs"; + }; + + fileSystems."/mnt/c" = + { device = "C:\134"; + fsType = "9p"; + }; + + fileSystems."/mnt/d" = + { device = "D:\134"; + fsType = "9p"; + }; + + fileSystems."/mnt/f" = + { device = "F:\134"; + fsType = "9p"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.bond0.useDHCP = lib.mkDefault true; + # networking.interfaces.bonding_masters.useDHCP = lib.mkDefault true; + # networking.interfaces.dummy0.useDHCP = lib.mkDefault true; + # networking.interfaces.eth0.useDHCP = lib.mkDefault true; + # networking.interfaces.sit0.useDHCP = lib.mkDefault true; + # networking.interfaces.tunl0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}