diff --git a/apply.sh b/apply.sh index c0241f4..33f4246 100755 --- a/apply.sh +++ b/apply.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -sudo rsync -ah --delete --progress `pwd`/ /root/nixos/ -sudo rm /etc/nixos/configuration.nix -sudo ln -s /root/nixos/machine/`hostname`.nix /etc/nixos/configuration.nix -sudo nixos-rebuild switch +# sudo rsync -ah --delete --progress `pwd`/ /root/nixos/ +# sudo rm /etc/nixos/configuration.nix +# sudo ln -s /root/nixos/machine/`hostname`.nix /etc/nixos/configuration.nix +# sudo nixos-rebuild switch + +sudo nixos-rebuild switch --show-trace --flake ~/nixos-config/#`hostname` \ No newline at end of file diff --git a/config.json b/config.json index faf9ffe..fc2b13f 100755 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "defaultStrategy": "agile", + "defaultStrategy": "lazy", "strategyOnDischarging": "", "batteryChargingStatusPath": "", "strategies": { diff --git a/configs/common.nix b/configs/common.nix index faf0569..c7efda8 100755 --- a/configs/common.nix +++ b/configs/common.nix @@ -66,7 +66,7 @@ btrfs-progs cargo - # dog # different cat + # dog # cat replace doggo # DNS Resolver du-dust diff --git a/flake.lock b/flake.lock index 30b058e..c07847c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,43 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "fw-fanctrl": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724704488, + "narHash": "sha256-QmAanotjk81zsCwHI52XS4u9Cjv6KjNzTkYsAYFrubM=", + "owner": "TamtamHero", + "repo": "fw-fanctrl", + "rev": "db96c5962cff24f4c5977e30ca1c7626fb4171c7", + "type": "github" + }, + "original": { + "owner": "TamtamHero", + "ref": "packaging/nix", + "repo": "fw-fanctrl", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -71,6 +109,7 @@ }, "root": { "inputs": { + "fw-fanctrl": "fw-fanctrl", "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index 5afc215..9029ef3 100644 --- a/flake.nix +++ b/flake.nix @@ -12,9 +12,22 @@ url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + + fw-fanctrl = { + url = "github:TamtamHero/fw-fanctrl/packaging/nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, nixos-hardware, ... } @ inputs: + outputs = + { self + , nixpkgs + , nixpkgs-unstable + , home-manager + , nixos-hardware + , fw-fanctrl + , ... + } @ inputs: let inherit (self) outputs; @@ -42,6 +55,16 @@ ./machine/desktop.nix ]; }; + + framework = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs outputs; }; + modules = [ + fw-fanctrl.nixosModules.default + ./machine/framework.nix + ]; + }; + }; }; } diff --git a/machine/desktop.nix b/machine/desktop.nix index b9c9098..b59850a 100755 --- a/machine/desktop.nix +++ b/machine/desktop.nix @@ -25,7 +25,6 @@ in ]; # Configure your nixpkgs instance config = { - # Disable if you don't want unfree packages allowUnfree = true; }; }; diff --git a/machine/framework-hardware-configuration.nix b/machine/framework-hardware-configuration.nix new file mode 100644 index 0000000..8b7ba98 --- /dev/null +++ b/machine/framework-hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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 = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/5549d49d-165e-4a45-973e-6a32a63e31be"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-4f42a0a6-1f09-413c-8af3-9be8fc5c1b25".device = "/dev/disk/by-uuid/4f42a0a6-1f09-413c-8af3-9be8fc5c1b25"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/20D2-E669"; + fsType = "vfat"; + }; + + 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.wlp166s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machine/framework.nix b/machine/framework.nix index 7d6569a..d1ca589 100755 --- a/machine/framework.nix +++ b/machine/framework.nix @@ -1,14 +1,34 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, outputs, inputs, ... }: let - unstable = import { config = { allowUnfree = true; }; }; be = import ../configs/borg-exclude.nix; secrets = import ../configs/secrets.nix; wireguard = import ../configs/wireguard.nix; in { + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + config = { + allowUnfree = true; + }; + }; + imports = [ - - /etc/nixos/hardware-configuration.nix + ./framework-hardware-configuration.nix + inputs.nixos-hardware.nixosModules.framework-12th-gen-intel ../configs/browser.nix ../configs/common.nix ../configs/docker.nix @@ -17,7 +37,6 @@ in ../configs/plasma-wayland.nix ../configs/user-gui.nix ../configs/user.nix - /home/alex/Workspace/fw-fanctrl-nix/service.nix ]; boot = { @@ -28,13 +47,13 @@ in }; }; - nixpkgs.config = { - allowUnfree = true; - packageOverrides = pkgs: { - intel-vaapi-driver = - pkgs.intel-vaapi-driver.override { enableHybridCodec = true; }; - }; - }; + # nixpkgs.config = { + # allowUnfree = true; + # packageOverrides = pkgs: { + # intel-vaapi-driver = + # pkgs.intel-vaapi-driver.override { enableHybridCodec = true; }; + # }; + # }; # nixpkgs.localSystem = { # gcc.arch = "alderlake"; @@ -46,24 +65,31 @@ in networking = { hostName = "framework"; - # wireguard.interfaces = { - # wg0 = { - # ips = [ "10.100.0.7/24" ]; - # privateKey = secrets.wireguard-framework-private; - - # peers = [{ - # publicKey = wireguard.wireguard-vps-public; - # presharedKey = secrets.wireguard-preshared; - # allowedIPs = [ "10.100.0.0/24" ]; - # endpoint = "old.szczepan.ski:51820"; - # persistentKeepalive = 25; - # }]; - # }; - # }; }; time.timeZone = "Europe/Berlin"; + programs.fw-fanctrl = { + enable = true; + config = { + defaultStrategy = "lazy"; + strategies = { + "lazy" = { + fanSpeedUpdateFrequency = 5; + movingAverageInterval = 30; + speedCurve = [ + { temp = 0; speed = 15; } + { temp = 50; speed = 15; } + { temp = 65; speed = 25; } + { temp = 70; speed = 35; } + { temp = 75; speed = 50; } + { temp = 85; speed = 100; } + ]; + }; + }; + }; + }; + hardware = { keyboard.qmk.enable = true; enableAllFirmware = true; @@ -91,16 +117,6 @@ in fwupd.enable = true; - fw-fanctrl = { - enable = true; - configJsonPath = "/home/alex/nixos-config/config.json"; - }; - - # displayManager.autoLogin = { - # enable = true; - # user = "alex"; - # }; - pipewire = { enable = true; alsa.enable = true; @@ -168,7 +184,7 @@ in # systemd.services.nix-daemon.serviceConfig.LimitNOFILE = 40960; - environment.systemPackages = with unstable.pkgs; [ + environment.systemPackages = with pkgs.unstable; [ psensor veracrypt gnumake @@ -185,7 +201,6 @@ in homebank # fahviewer # fahcontrol - (import ("/home/alex/Workspace/fw-ectool/default.nix")) ]; # Set up deep sleep + hibernation diff --git a/machine/vps-arm.nix b/machine/vps-arm.nix index 1715ede..9ab4d24 100755 --- a/machine/vps-arm.nix +++ b/machine/vps-arm.nix @@ -61,8 +61,6 @@ in }; }; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - environment.systemPackages = with pkgs; [ goaccess xd