From 7587d91cd16353fbe1df63cd5112056d0a1ce33c Mon Sep 17 00:00:00 2001 From: iofq Date: Sun, 30 Apr 2023 14:15:07 -0500 Subject: [PATCH] 4/30 --- flake.lock | 54 +++++++++++++++++++++++++++++++++- flake.nix | 29 ++++++++++--------- hosts/configuration.nix | 1 + hosts/default.nix | 58 ++++++++++++++++++------------------- hosts/home.nix | 2 ++ hosts/t14/configuration.nix | 3 +- hosts/t14/home.nix | 3 +- modules/wayland/default.nix | 42 +++++++++++++++++++++++++++ 8 files changed, 146 insertions(+), 46 deletions(-) diff --git a/flake.lock b/flake.lock index 549b521..ef66b60 100755 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,63 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1682817260, + "narHash": "sha256-kFMXzKNj4d/0Iqbm5l57rHSLyUeyCLMuvlROZIuuhvk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "db1e4eeb0f9a9028bcb920e00abbc1409dd3ef36", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1682779028, + "narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54abe781c482f51ff4ff534ebaba77db5bd97442", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1682823324, + "narHash": "sha256-KNu3OAqVyoKwnDP+gqptjQYCnZXxEwXccR89c0r1/8k=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "4f308f76633f81253a12b80e7b05b80d325005b2", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 9b012de..89bdad2 100755 --- a/flake.nix +++ b/flake.nix @@ -6,18 +6,19 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; home-manager = { url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; }; + inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, home-manager, nixos-hardware, ... }: - let - username = "e"; - in { - nixosConfigurations = ( - import ./hosts { - inherit (nixpkgs) lib; - inherit nixos-hardware; - inherit nixpkgs home-manager username; - } - ); - }; - } + sops-nix.url = "github:Mic92/sops-nix"; + }; + outputs = { self, nixpkgs, home-manager, nixos-hardware, sops-nix, ... }: + let + username = "e"; + in { + nixosConfigurations = ( + import ./hosts { + inherit (nixpkgs) lib; + inherit nixpkgs home-manager nixos-hardware sops-nix username; + } + ); + }; + } diff --git a/hosts/configuration.nix b/hosts/configuration.nix index 64ec338..22b4089 100755 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -14,5 +14,6 @@ }; users.groups.plugdev = {}; security.pam.services.swaylock = {}; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; system.stateVersion = "22.11"; } diff --git a/hosts/default.nix b/hosts/default.nix index c9305a5..4b890e7 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,4 @@ -{ lib, nixpkgs, username, home-manager, nixos-hardware, ... }: +{ lib, nixpkgs, username, home-manager, nixos-hardware, sops-nix, ... }: let system = "x86_64-linux"; @@ -12,36 +12,36 @@ let in { t14 = lib.nixosSystem { - inherit system; - specialArgs = { - inherit username; - host = { - hostName = "t14"; + inherit system; + specialArgs = { + inherit username; + host = { + hostName = "t14"; + }; }; - }; - modules = [ - ./configuration.nix - ./t14/configuration.nix - nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit username; - host = { - hostName = "t14"; + modules = [ + sops-nix.nixosModules.sops + ./configuration.nix + ./t14/configuration.nix + nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + inherit username; }; - }; - home-manager.users.${username} = { - programs.home-manager.enable = true; - imports = [ - ./home.nix - ./t14/home.nix + home-manager.sharedModules = [ + sops-nix.homeManagerModule ]; - }; - } - ]; - }; + home-manager.users.${username} = { + programs.home-manager.enable = true; + imports = [ + ./t14/home.nix + ]; + }; + } + ]; + }; -} + } diff --git a/hosts/home.nix b/hosts/home.nix index 84bf148..ea0bb6d 100755 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -8,6 +8,8 @@ htop appimage-run ripgrep + fluxcd + k9s ]; }; systemd.user.startServices = "sd-switch"; diff --git a/hosts/t14/configuration.nix b/hosts/t14/configuration.nix index 3705b34..88143fc 100755 --- a/hosts/t14/configuration.nix +++ b/hosts/t14/configuration.nix @@ -1,4 +1,4 @@ -{ nixos-hardware, config, pkgs, ... }: +{ config, pkgs, nixos-hardware, sops-nix, ... }: { imports = [ @@ -12,6 +12,7 @@ fonts = { fonts = with pkgs; [ spleen + roboto ]; }; programs.light.enable = true; diff --git a/hosts/t14/home.nix b/hosts/t14/home.nix index b4dbd44..b5e3c16 100755 --- a/hosts/t14/home.nix +++ b/hosts/t14/home.nix @@ -3,16 +3,17 @@ imports = [ ../../modules/wayland ../../modules/librewolf + ../home.nix ]; home = { packages = with pkgs; [ - neofetch pulseaudio pulsemixer alsa-utils discord signal-desktop runelite + framesh ]; }; } diff --git a/modules/wayland/default.nix b/modules/wayland/default.nix index f922c6a..e362d78 100644 --- a/modules/wayland/default.nix +++ b/modules/wayland/default.nix @@ -71,6 +71,7 @@ "XF86AudioRaiseVolume" = "exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'"; "XF86AudioLowerVolume" = "exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'"; "XF86AudioMute" = "exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'"; + "XF86Display" = "exec 'swaymsg \"output eDP-1 toggle\"'"; }; assigns = { "9" = [ @@ -129,6 +130,10 @@ }; }; }; + extraConfig='' + bindswitch lid:on output eDP-1 disable + bindswitch lid:off output eDP-1 enable + ''; }; programs.i3status = { enable = true; @@ -204,4 +209,41 @@ { timeout = 1200; command = "${pkgs.sway}/bin/swaymsg \"output * power off\"";} ]; }; + services.kanshi = { + enable = true; + profiles = { + nodock = { + outputs = [ + { + criteria = "eDP-1"; + } + ]; + }; + dock = { + outputs = [ + { + criteria = "DP-4"; + status = "enable"; + mode = "1920x1080@60Hz"; + position = "0,0"; + } + ]; + }; + bothdock = { + outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + position = "0,1080"; + } + { + criteria = "DP-4"; + status = "enable"; + mode = "1920x1080@60Hz"; + position = "0,0"; + } + ]; + }; + }; + }; }