Merge pull request 'refactor: new configuration structure using flake-parts' (#1) from refactor/flake-parts into main

Reviewed-on: #1
This commit is contained in:
Michael Thomas 2024-07-17 08:24:03 -04:00
commit 7bbc60225f
37 changed files with 870 additions and 583 deletions

23
common/default.nix Normal file
View File

@ -0,0 +1,23 @@
{
inputs,
config,
lib,
...
}: {
imports =
[
(lib.mkAliasOptionModule ["hm"] [
"home-manager"
"users"
config.my.user
])
]
++ lib.my.getModules [./.];
hm.imports = [./home.nix];
home-manager.extraSpecialArgs = {
inherit inputs;
};
home-manager.useGlobalPkgs = true;
}

25
common/home.nix Normal file
View File

@ -0,0 +1,25 @@
{
inputs,
lib,
pkgs,
...
}: {
imports = lib.my.getHmModules [./.];
# my = {
# difftastic.enable = true;
# direnv.enable = true;
# # helix.enable = true;
# git.enable = true;
# # gitui.enable = true;
# neovim.enable = true;
# yazi.enable = true;
# zsh.enable = true;
# };
# let standalone home-manager and home-manager in nixos/nix-darwin use the same derivation
home.packages = [
(pkgs.callPackage (inputs.home-manager + /home-manager) {path = inputs.home-manager;})
];
# home.stateVersion = "23.11";
}

26
common/my/default.nix Normal file
View File

@ -0,0 +1,26 @@
{lib, ...}: let
inherit (lib) mkOption types;
in {
options.my = {
user = mkOption {type = types.str;};
name = mkOption {type = types.str;};
email = mkOption {type = types.str;};
uid = mkOption {type = types.int;};
keys = mkOption {type = types.listOf types.singleLineStr;};
};
config = {
my = {
user = "michael";
name = "Michael Thomas";
email = "michaelhthomas@outlook.com";
uid = 1000;
keys = [
# Neptune
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUYHiTel+RDzygCeNwV25cnBBNioM19EQWqxPC+xq7lNlNcAQ4wi9JIOONVGkshxPXzKZyR3F53Igs9JZr1E9088L52eUp35JhW1pthai82cw1jGkj9wxcKJnU6b7QNDKA+ejPTC/ciFFKytMyPgID0ICzBRQsnj15i4lGvGDgfTQ7qfI2J855H7S7qOpY7cbsGfeoz3f8Ye1FspJFDsNu9QhX05iunBcbni0uLoTtgS5cEBRr7H9RkKR7GCfd4Ae/sp+aeDkLU4aBkEi+A8VLfR74Juia1j/3mAAmkgJKGcBCKUv0ixBGd6XclZmkF8f2Hx0z8mDxJ7U8lsDUSKdvxK7fecsM4F/GTvjrUxV1nLD4SRQ06GtBmGQGDzIn3Nm1URd6gGT9W3486XJsqmGzjuHa5o4WhmBgh/Gs8xUcv7kWD5enrYacBr+HKVJWnnLFp+XfAYaMCT6j/4jc4D9/9hijRbhboICTDxWCWtFgz7QpsO6BQpi/wkR4Ql61vPc= michael@neptune"
# Oracle
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPc/HYsbpVsyoU2n0EiqQ4+3aSiFPtddjPCGK187W24f michael@oracle"
];
};
};
}

1
common/my/home.nix Symbolic link
View File

@ -0,0 +1 @@
default.nix

27
common/system/default.nix Normal file
View File

@ -0,0 +1,27 @@
{
config,
pkgs,
...
}: {
nix.gc = {
automatic = true;
options = "--delete-older-than 30d";
};
nix.optimise.automatic = true;
nix.settings = {
extra-experimental-features = [
"flakes"
"nix-command"
];
keep-outputs = true;
log-lines = 25;
tarball-ttl = 43200;
trusted-users = [
"root"
config.my.user
];
};
nix.package = pkgs.nix;
programs.zsh.enable = true;
time.timeZone = "America/New_York";
}

18
darwin/default.nix Normal file
View File

@ -0,0 +1,18 @@
{
inputs,
inputs',
lib,
...
}: {
imports =
[
inputs.agenix.darwinModules.default
inputs.home-manager.darwinModules.home-manager
../common
]
++ lib.my.getModules [./.];
hm.imports = [./home.nix];
environment.systemPackages = [inputs'.agenix.packages.default];
}

3
darwin/home.nix Normal file
View File

@ -0,0 +1,3 @@
{lib, ...}: {
imports = lib.my.getHmModules [./.];
}

68
flake.lock generated
View File

@ -153,6 +153,24 @@
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
@ -540,6 +558,18 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1719075281,
@ -603,11 +633,27 @@
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1719690277,
"narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"home-manager": "home-manager_3",
"nix-darwin": "nix-darwin",
@ -651,6 +697,7 @@
"agenix": "agenix",
"ags": "ags",
"darwin": "darwin_2",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2",
"hyprland": "hyprland",
"nix-vscode-extensions": "nix-vscode-extensions",
@ -658,6 +705,7 @@
"nixvim": "nixvim",
"nur": "nur",
"rust-overlay": "rust-overlay",
"treefmt-nix": "treefmt-nix_2",
"unstable": "unstable",
"utils": "utils"
}
@ -776,6 +824,24 @@
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1719887753,
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1719254875,

204
flake.nix
View File

@ -18,6 +18,8 @@
};
utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
nixvim = {
url = "github:nix-community/nixvim/nixos-24.05";
inputs.nixpkgs.follows = "nixpkgs";
@ -32,197 +34,17 @@
};
};
outputs = {
self,
nixpkgs,
unstable,
nur,
agenix,
utils,
rust-overlay,
nix-vscode-extensions,
darwin,
home-manager,
...
} @ inputs: let
forAllSystems = nixpkgs.lib.genAttrs utils.lib.defaultSystems;
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
overlays = import ./overlays {inherit inputs;};
};
defaultModules = [
self.overlaysModule
home-manager.nixosModules.home-manager
./modules
];
baseHomeModule = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit inputs;};
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
imports = [./flakes];
};
in {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system:
import ./pkgs {
pkgs = nixpkgs.legacyPackages.${system};
inherit inputs;
});
overlays = import ./overlays {inherit inputs;};
overlaysModule = {
nixpkgs.overlays = builtins.attrValues self.overlays;
};
nixosConfigurations = let
fullNixOSModules =
defaultModules
++ [
baseHomeModule
{
home-manager.users.michael = import ./user/environments/nixos/home.nix;
}
];
in {
kitchen = nixpkgs.lib.nixosSystem {
system = utils.lib.system.x86_64-linux;
modules =
fullNixOSModules
++ [
./modules/common.nix
./modules/containers.nix
./machines/kitchen/configuration.nix
];
specialArgs = {inherit inputs;};
};
thinkcentre = nixpkgs.lib.nixosSystem {
system = utils.lib.system.x86_64-linux;
modules =
fullNixOSModules
++ [
./modules/common.nix
./modules/hyprland.nix
./modules/containers.nix
./machines/thinkcentre/configuration.nix
agenix.nixosModules.default
{
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
}
];
specialArgs = {inherit inputs;};
};
terra = nixpkgs.lib.nixosSystem {
system = utils.lib.system.x86_64-linux;
modules =
fullNixOSModules
++ [
./modules/common.nix
./modules/hyprland.nix
./modules/containers.nix
./modules/applications/steam
./machines/terra/configuration.nix
agenix.nixosModules.default
{
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
}
];
specialArgs = {inherit inputs;};
};
oracle = nixpkgs.lib.nixosSystem {
system = utils.lib.system.x86_64-linux;
modules =
defaultModules
++ [
./modules/nix.nix
baseHomeModule
{
home-manager.users.michael = import ./user/environments/nixos-server/home.nix;
}
agenix.nixosModules.default
{
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
}
./machines/oracle/configuration.nix
];
specialArgs = {inherit inputs;};
};
};
darwinConfigurations = {
mac = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs;};
modules = [
self.overlaysModule
home-manager.darwinModules.home-manager
baseHomeModule
{
home-manager.users.michael = import ./user/environments/mac/home.nix;
}
./modules/yabai.nix
./machines/mac/configuration.nix
];
};
};
homeConfigurations = {
nixos = inputs.home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
homeDirectory = "/home/michael";
username = "michael";
stateVersion = "21.05";
configuration = {
config,
pkgs,
...
}: {
programs.home-manager.enable = true;
imports = [
./user/environments/nixos/home.nix
];
};
};
mac = inputs.home-manager.lib.homeManagerConfiguration {
system = "aarch64-darwin";
homeDirectory = "/Users/michael";
username = "michael";
stateVersion = "22.05";
configuration = {
config,
pkgs,
...
}: {
programs.home-manager.enable = true;
imports = [
./user/environments/mac/home.nix
];
};
};
};
};
# // utils.lib.eachSystem [ "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (system: {
# nixpkgs = import nixpkgs {
# inherit system;
# overlays = [
# self.overlays.default
# ];
# config.allowUnfree = true;
# };
# });
}

44
flakes/darwin.nix Normal file
View File

@ -0,0 +1,44 @@
{
inputs,
withSystem,
...
}: let
mkDarwin = {
system ? "aarch64-darwin",
modules ? [],
}:
withSystem system (
{
inputs',
lib,
pkgs,
system,
...
}:
inputs.darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit
inputs
inputs'
lib
pkgs
;
};
modules = [../darwin] ++ modules;
}
);
in {
flake.darwinConfigurations = {
mac = mkDarwin {
modules = [
{
hm = import ../user/environments/mac/home.nix;
}
../modules/yabai.nix
../machines/mac/configuration.nix
];
};
};
}

9
flakes/default.nix Normal file
View File

@ -0,0 +1,9 @@
{
imports = [
./lib.nix
./darwin.nix
./nixos.nix
./packages.nix
./treefmt.nix
];
}

30
flakes/lib.nix Normal file
View File

@ -0,0 +1,30 @@
{
perSystem = {
inputs',
config,
pkgs,
...
}: let
# use nixpkgs lib instead of flake-parts lib
# avoids home-manager warning about version mismatch
inherit (pkgs) lib;
in {
_module.args.lib = lib.extend (
final: prev: {
my = let
lib = final;
getPaths = file: root:
builtins.filter builtins.pathExists (
map (dir: root + "/${dir}/${file}") (
lib.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir root))
)
);
in {
inherit getPaths;
getModules = builtins.concatMap (getPaths "default.nix");
getHmModules = builtins.concatMap (getPaths "home.nix");
};
}
);
};
}

107
flakes/nixos.nix Normal file
View File

@ -0,0 +1,107 @@
{
inputs,
self,
withSystem,
...
}: let
mkNixos = {
system ? "x86_64-linux",
nixpkgs ? inputs.nixpkgs,
config ? {},
overlays ? [],
modules ? [],
}:
withSystem system (
{
inputs',
lib,
pkgs,
system,
...
}: let
customPkgs = import nixpkgs (
lib.recursiveUpdate {
inherit system;
overlays = (builtins.attrValues self.overlays) ++ overlays;
config.allowUnfree = true;
} {inherit config;}
);
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs inputs' lib;
pkgs =
if (nixpkgs != inputs.nixpkgs || config != {} || overlays != [])
then customPkgs
else pkgs;
};
modules = [../nixos] ++ modules;
}
);
in {
flake.nixosConfigurations = let
defaultModules = [
../modules
inputs.agenix.nixosModules.default
{
environment.systemPackages = [
inputs.agenix.packages.x86_64-linux.default
];
}
];
fullNixOSModules =
defaultModules
++ [
{
home-manager.users.michael = import ../user/environments/nixos/home.nix;
}
];
in {
kitchen = mkNixos {
modules =
fullNixOSModules
++ [
../modules/common.nix
../modules/containers.nix
../machines/kitchen/configuration.nix
];
};
thinkcentre = mkNixos {
modules =
fullNixOSModules
++ [
../modules/common.nix
../modules/containers.nix
../machines/thinkcentre/configuration.nix
];
};
terra = mkNixos {
modules =
fullNixOSModules
++ [
../modules/common.nix
../modules/containers.nix
../machines/terra/configuration.nix
];
};
oracle = mkNixos {
modules =
defaultModules
++ [
{
home-manager.users.michael = import ../user/environments/nixos-server/home.nix;
}
../machines/oracle/configuration.nix
];
};
};
}

23
flakes/packages.nix Normal file
View File

@ -0,0 +1,23 @@
{
self,
inputs,
...
}: {
perSystem = {
lib,
system,
...
}: let
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = builtins.attrValues self.overlays;
};
in {
_module.args.pkgs = pkgs;
packages = import ../pkgs {
inherit inputs pkgs;
};
};
}

8
flakes/treefmt.nix Normal file
View File

@ -0,0 +1,8 @@
{inputs, ...}: {
imports = [inputs.treefmt-nix.flakeModule];
perSystem.treefmt = {
projectRootFile = "flake.nix";
programs.alejandra.enable = true;
};
}

View File

@ -46,6 +46,8 @@
programs.zsh.enable = true;
my.hyprland.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.michael = {
isNormalUser = true;

View File

@ -56,27 +56,6 @@
nix-daemon.enable = true;
};
nixpkgs = {
# Workaround for pyopenssl being marked broken
config.allowBroken = true;
};
nix = {
package = pkgs.nix;
gc = {
automatic = true;
interval.Day = 7;
options = "--delete-older-than 7d";
};
extraOptions = ''
experimental-features = nix-command flakes
'';
settings = {
auto-optimise-store = false;
trusted-users = ["root" "michael"];
};
};
system = {
# Since it's not possible to declare default shell, run this command after build
activationScripts.postActivation.text = ''sudo chsh -s ${pkgs.zsh}/bin/zsh'';

View File

@ -47,6 +47,10 @@
programs.zsh.enable = true;
environment.variables.EDITOR = "nvim";
my.hyprland.enable = true;
my.libreoffice.enable = true;
my.steam.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.michael = {
isNormalUser = true;

View File

@ -114,6 +114,9 @@
firewallInterface = "wg0";
};
# TODO: Disable desktop
my.hyprland.enable = true;
my.services.forgejo = {
enable = true;
port = 3000;

View File

@ -1,8 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
libreoffice-qt
hunspell
hunspellDicts.uk_UA
hunspellDicts.th_TH
];
}

View File

@ -1,7 +0,0 @@
{pkgs, ...}: {
programs.steam = {
enable = true;
package = pkgs.unstable.steam;
gamescopeSession.enable = true;
};
}

View File

@ -7,7 +7,6 @@
./flatpak.nix
./fonts.nix
./hosts.nix
./nix.nix
./sound.nix
];
}

View File

@ -1,6 +1,5 @@
{
imports = [
./server
./services
];
}

View File

@ -1,69 +0,0 @@
{
pkgs,
inputs,
...
}: let
pkgs-hyprland = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
};
hardware.opengl = {
package = pkgs-hyprland.mesa.drivers;
driSupport32Bit = true;
package32 = pkgs-hyprland.pkgsi686Linux.mesa.drivers;
};
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
environment.systemPackages = with pkgs; [
# Theme
adw-gtk3
# Applications
gnome.nautilus
gnome.sushi
gnome.eog
gnome.totem
gnome.cheese
gnome.file-roller
gnome.gnome-weather
gnome.gnome-contacts
gnome.gnome-calendar
gnome.gnome-screenshot
gnome.gnome-dictionary
gnome.gnome-font-viewer
gnome.gnome-system-monitor
monophony # music player
# Nvim clipboard
wl-clipboard
];
# Required for Nautilus to work outside GNOME
services.gvfs.enable = true;
# Use CAPSLOCK as Hyper key
services.keyd = {
enable = true;
keyboards.default = {
ids = ["*"];
settings.main = {
capslock = "overload(meta, esc)";
};
};
};
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
user = "greeter";
};
};
};
}

View File

@ -1,23 +0,0 @@
{pkgs, ...}: {
nix = {
extraOptions = ''
experimental-features = flakes nix-command
'';
# this is required until nix 2.4 is released
package = pkgs.nixFlakes;
settings = {
auto-optimise-store = true;
trusted-users = ["root" "michael"];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
};
nixpkgs.config = {
allowUnfree = true;
};
}

45
nixos/ags/home.nix Normal file
View File

@ -0,0 +1,45 @@
{
inputs,
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.ags;
in {
imports = [inputs.ags.homeManagerModules.default];
options.my.ags = {
enable = mkEnableOption "ags";
};
config = mkIf cfg.enable {
programs.ags = {
enable = true;
extraPackages = with pkgs; [
bun
which
fzf
# inputs.matugen.packages.${system}.default
slurp
wf-recorder
wl-clipboard
wayshot
swappy
hyprpicker
pavucontrol
networkmanager
gtk3
];
};
home.packages = with pkgs; [
brightnessctl
fd
dart-sass
swww
];
};
}

14
nixos/default.nix Normal file
View File

@ -0,0 +1,14 @@
{
inputs,
lib,
...
}: {
imports =
[
inputs.home-manager.nixosModules.home-manager
../common
]
++ lib.my.getModules [./.];
hm.imports = lib.my.getHmModules [./.];
}

View File

@ -0,0 +1,81 @@
{
pkgs,
inputs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
pkgs-hyprland = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
cfg = config.my.hyprland;
in {
options.my.hyprland = {
enable = mkEnableOption "hyprland";
};
config = mkIf cfg.enable {
hm.my.hyprland.enable = true;
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
};
hardware.opengl = {
package = pkgs-hyprland.mesa.drivers;
driSupport32Bit = true;
package32 = pkgs-hyprland.pkgsi686Linux.mesa.drivers;
};
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
environment.systemPackages = with pkgs; [
# Theme
adw-gtk3
# Applications
gnome.nautilus
gnome.sushi
gnome.eog
gnome.totem
gnome.cheese
gnome.file-roller
gnome.gnome-weather
gnome.gnome-contacts
gnome.gnome-calendar
gnome.gnome-screenshot
gnome.gnome-dictionary
gnome.gnome-font-viewer
gnome.gnome-system-monitor
monophony # music player
# Nvim clipboard
wl-clipboard
];
# Required for Nautilus to work outside GNOME
services.gvfs.enable = true;
# Use CAPSLOCK as Hyper key
services.keyd = {
enable = true;
keyboards.default = {
ids = ["*"];
settings.main = {
capslock = "overload(meta, esc)";
};
};
};
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
user = "greeter";
};
};
};
};
}

236
nixos/hyprland/home.nix Normal file
View File

@ -0,0 +1,236 @@
{
pkgs,
inputs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.hyprland;
in {
imports = [
inputs.hyprland.homeManagerModules.default
];
options.my.hyprland = {
enable = mkEnableOption "hyprland";
};
config = mkIf cfg.enable {
my.ags.enable = true;
my.wofi.enable = true;
home.packages = with pkgs; [
pavucontrol
swaybg
];
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
settings = let
# No gaps or border when only one window
no_gaps_when_only = 1;
in {
"$mod" = "SUPER";
general = {
gaps_in = 5;
gaps_out = 10;
};
input = {
follow_mouse = 2;
};
dwindle = {
inherit no_gaps_when_only;
};
master = {
inherit no_gaps_when_only;
};
exec-once = [
"hyprctl setcursor Adwaita 24"
"ags"
"swaybg -i /home/michael/Photos/wallpaper.jpg"
"hypridle"
];
bind =
[
# Program launcher
"$mod, SPACE, exec, wofi --show drun"
# Program shortcuts
"$mod, F, exec, firefox"
"$mod, Q, killactive"
"$mod, T, exec, foot"
", Print, exec, grimblast copy area"
# Windows
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
# Moving windows
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, L, movewindow, r"
]
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
)
10)
);
};
extraConfig = ''
# will switch to a submap called resize
bind=$mod,R,submap,resize
# media controls
bindel=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,h,resizeactive,-10 0
binde=,j,resizeactive,0 10
binde=,k,resizeactive,0 -10
binde=,l,resizeactive,10 0
# use reset to go back to the global submap
bind=,escape,submap,reset
# will reset the submap, meaning end the current one and return to the global one
submap=reset
'';
};
gtk = {
enable = true;
font.name = "Inter 11";
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Papirus";
package = pkgs.papirus-icon-theme;
};
};
home.pointerCursor = {
gtk.enable = true;
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = 24;
};
programs.hyprlock = {
enable = true;
settings = {
general = {
no_fade_in = false;
grace = 0;
disable_loading_bar = true;
};
background = {
monitor = "";
path = "~/Photos/wallpaper.jpg";
blur_passes = 3;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
};
input-field = {
monitor = "";
size = "250, 60";
outline_thickness = 2;
dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(0, 0, 0, 0.5)";
font_color = "rgb(200, 200, 200)";
fade_on_empty = false;
font_family = "Inter";
placeholder_text = "Enter Password";
hide_input = false;
position = "0, 375";
halign = "center";
valign = "bottom";
};
label = [
# Time
{
monitor = "";
text = "cmd[update:1000] echo \"$(date +\"%-I:%M %P\")\"";
color = "rgba(255, 255, 255, 0.6)";
font_size = 120;
font_family = "Inter ExtraBold";
position = "0, -300";
halign = "center";
valign = "top";
}
# User
{
monitor = "";
text = config.my.name;
color = "rgba(255, 255, 255, 0.6)";
font_size = 24;
font_family = "Inter Semibold";
position = "0, 450";
halign = "center";
valign = "bottom";
}
];
};
};
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
# Dim screen
{
timeout = 150; # 2.5 min
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
# Lock
{
timeout = 300; # 5 min
on-timeout = "loginctl lock-session";
}
# Turn off screen
{
timeout = 330; # 5.5 min
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
# Suspend
{
timeout = 1800; # 30 min
on-timeout = "systemctl suspend";
}
];
};
};
};
}

View File

@ -0,0 +1,22 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.libreoffice;
in {
options.my.libreoffice = {
enable = mkEnableOption "libreoffice";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
libreoffice-qt
hunspell
hunspellDicts.uk_UA
hunspellDicts.th_TH
];
};
}

21
nixos/steam/default.nix Normal file
View File

@ -0,0 +1,21 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.steam;
in {
options.my.steam = {
enable = mkEnableOption "steam";
};
config = mkIf cfg.enable {
programs.steam = {
enable = true;
package = pkgs.unstable.steam;
gamescopeSession.enable = true;
};
};
}

18
nixos/wofi/home.nix Normal file
View File

@ -0,0 +1,18 @@
{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.wofi;
in {
options.my.wofi = {
enable = mkEnableOption "wofi";
};
config = mkIf cfg.enable {
programs.wofi = {
enable = true;
};
};
}

View File

@ -1,13 +1,11 @@
{
imports = [
../../modules/ags
../../modules/dev.nix
../../modules/firefox.nix
../../modules/fonts.nix
../../modules/foot.nix
../../modules/git.nix
../../modules/git_nixos.nix
../../modules/hyprland.nix
../../modules/nvim.nix
../../modules/vscode.nix
../../modules/zellij

View File

@ -1,31 +0,0 @@
{
inputs,
pkgs,
...
}: {
imports = [inputs.ags.homeManagerModules.default];
programs.ags = {
enable = true;
extraPackages = with pkgs; [
bun
which
dart-sass
fd
fzf
brightnessctl
swww
# inputs.matugen.packages.${system}.default
slurp
wf-recorder
wl-clipboard
wayshot
swappy
hyprpicker
pavucontrol
networkmanager
gtk3
];
};
}

View File

@ -1,223 +0,0 @@
{
pkgs,
inputs,
...
}: {
imports = [
inputs.hyprland.homeManagerModules.default
./wofi.nix
];
home.packages = with pkgs; [
pavucontrol
swaybg
];
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
settings = let
# No gaps or border when only one window
no_gaps_when_only = 1;
in {
"$mod" = "SUPER";
general = {
gaps_in = 5;
gaps_out = 10;
};
input = {
follow_mouse = 2;
};
dwindle = {
inherit no_gaps_when_only;
};
master = {
inherit no_gaps_when_only;
};
exec-once = [
"hyprctl setcursor Adwaita 24"
"ags"
"swaybg -i /home/michael/Photos/wallpaper.jpg"
"hypridle"
];
bind =
[
# Program launcher
"$mod, SPACE, exec, wofi --show drun"
# Program shortcuts
"$mod, F, exec, firefox"
"$mod, Q, killactive"
"$mod, T, exec, foot"
", Print, exec, grimblast copy area"
# Windows
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
# Moving windows
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, L, movewindow, r"
]
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
)
10)
);
};
extraConfig = ''
# will switch to a submap called resize
bind=$mod,R,submap,resize
# media controls
bindel=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,h,resizeactive,-10 0
binde=,j,resizeactive,0 10
binde=,k,resizeactive,0 -10
binde=,l,resizeactive,10 0
# use reset to go back to the global submap
bind=,escape,submap,reset
# will reset the submap, meaning end the current one and return to the global one
submap=reset
'';
};
gtk = {
enable = true;
font.name = "Inter 11";
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Papirus";
package = pkgs.papirus-icon-theme;
};
};
home.pointerCursor = {
gtk.enable = true;
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = 24;
};
programs.hyprlock = {
enable = true;
settings = {
general = {
no_fade_in = false;
grace = 0;
disable_loading_bar = true;
};
background = {
monitor = "";
path = "~/Photos/wallpaper.jpg";
blur_passes = 3;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
};
input-field = {
monitor = "";
size = "250, 60";
outline_thickness = 2;
dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(0, 0, 0, 0.5)";
font_color = "rgb(200, 200, 200)";
fade_on_empty = false;
font_family = "Inter";
placeholder_text = "Enter Password";
hide_input = false;
position = "0, 375";
halign = "center";
valign = "bottom";
};
label = [
# Time
{
monitor = "";
text = "cmd[update:1000] echo \"$(date +\"%-I:%M %P\")\"";
color = "rgba(255, 255, 255, 0.6)";
font_size = 120;
font_family = "Inter ExtraBold";
position = "0, -300";
halign = "center";
valign = "top";
}
# User
{
monitor = "";
text = "Michael Thomas";
color = "rgba(255, 255, 255, 0.6)";
font_size = 24;
font_family = "Inter Semibold";
position = "0, 450";
halign = "center";
valign = "bottom";
}
];
};
};
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
# Dim screen
{
timeout = 150; # 2.5 min
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
# Lock
{
timeout = 300; # 5 min
on-timeout = "loginctl lock-session";
}
# Turn off screen
{
timeout = 330; # 5.5 min
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
# Suspend
{
timeout = 1800; # 30 min
on-timeout = "systemctl suspend";
}
];
};
};
}

View File

@ -1,5 +0,0 @@
{...}: {
programs.wofi = {
enable = true;
};
}