From c06032eb481ab3102a3a9847ff90d55922677d7e Mon Sep 17 00:00:00 2001 From: Satria Date: Sun, 25 Jan 2026 18:58:00 +0700 Subject: [PATCH] flake init --- flake.lock | 152 ++++++++++++++++++++++++++++++++++ flake.nix | 42 ++++++++++ host/thinkpad/config.nix | 0 lib/options.nix | 45 ++++++++++ modules/hardware/thinkpad.nix | 0 5 files changed, 239 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 host/thinkpad/config.nix create mode 100644 lib/options.nix create mode 100644 modules/hardware/thinkpad.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ce84011 --- /dev/null +++ b/flake.lock @@ -0,0 +1,152 @@ +{ + "nodes": { + "ctp": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1769164550, + "narHash": "sha256-AxLb3L4j148v4Cj6ju5E9wsVdcHULuoI8il7+H5t6cs=", + "owner": "catppuccin", + "repo": "nix", + "rev": "deb2a5a54cf9e05ddf60aeeb933f60ad2fac20e1", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gl": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1762090880, + "narHash": "sha256-fbRQzIGPkjZa83MowjbD2ALaJf9y6KMDdJBQMKFeY/8=", + "owner": "nix-community", + "repo": "nixGL", + "rev": "b6105297e6f0cd041670c3e8628394d4ee247ed5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixGL", + "type": "github" + } + }, + "hm": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769289524, + "narHash": "sha256-6Cwtvzrw79cOk1lCzN2aKSVrpgSOSQoYhyMmhXXZjTA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2539eba97a6df237d75617c25cd2dbef92df3d5b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1769018530, + "narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88d3861acdd3d2f0e361767018218e51810df8a1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1746378225, + "narHash": "sha256-OeRSuL8PUjIfL3Q0fTbNJD/fmv1R+K2JAOqWJd3Oceg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "93e8cdce7afc64297cfec447c311470788131cd9", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1769170682, + "narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c5296fdd05cfa2c187990dd909864da9658df755", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "ctp": "ctp", + "gl": "gl", + "hm": "hm", + "nixpkgs": "nixpkgs_3" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6d0bb38 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "satr14's nix flake"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + hm = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + gl.url = "github:nix-community/nixGL"; + ctp.url = "github:catppuccin/nix"; + }; + + outputs = inputs: let + args = { inherit inputs; } // import ./lib/options.nix; + pkgs = import inputs.nixpkgs { + system = "x86_64-linux"; + overlays = [ inputs.gl.overlay ]; + config.allowUnfree = true; + }; + + nixosConfigForHost = { host }: pkgs.lib.nixosSystem { + specialArgs = args; + modules = [ + ./hosts/${host}/config.nix + inputs.ctp.nixosModules.catppuccin + inputs.hm.nixosModules.home-manager + { + home-manager = { + extraSpecialArgs = args; + backupFileExtension = ".hm-backup"; + users.${args.username} = import ./hosts/${host}/home.nix; + }; + } + ]; + }; + in { + nixosConfigurations = { + thinkpad = nixosConfigForHost "thinkpad"; + }; + }; +} diff --git a/host/thinkpad/config.nix b/host/thinkpad/config.nix new file mode 100644 index 0000000..e69de29 diff --git a/lib/options.nix b/lib/options.nix new file mode 100644 index 0000000..6257167 --- /dev/null +++ b/lib/options.nix @@ -0,0 +1,45 @@ +{ + flake-path = "~/Projects/nix-conf"; # set this to the cloned repo path + + hostname = "thinkpad"; + username = "satr14"; + + timezone = "Asia/Jakarta"; + locale = "en_US.UTF-8"; + + legacy-boot = false; # enables grub if true + enable-dm = true; # enable display manager (for server use) + + wol = "enp0s31f6"; # set to iface name to enable Wake-on-LAN + swapfile = 0; # * 1024; # swapfile size in MB, set to 0 to disable + resume-dev = "/dev/disk/by-uuid/1721721a-bb5a-4166-a077-9500d30be2ac"; # set to swap partition to enable hibernation, e.g. /dev/disk/by-uuid/1721721a-bb5a-4166-a077-9500d30be2ac + + rice = { + font = "monospace"; # global font for rice GUIs, leave empty to use monospace + bar = { + top = true; # false will put the bar at the bottom + fragmented = true; # enable fragmented bar, false will make it a single block + minimal = false; # less verbose bar + }; + gap = { # set the gap size in pixel + outer = 8; + inner = 4; + }; + borders = { + colored = false; # enable colored borders + rounded = 0; # rounded corners in pixel + size = 1; # border size in pixel + }; + }; + + ctp-opt = { # configure Catppuccin theme + primary = "sky"; + accent = "sapphire"; + flavor = "mocha"; + }; + + git = { # setup your git author + user = "Satria"; + email = "admin@satr14.my.id"; + }; +} diff --git a/modules/hardware/thinkpad.nix b/modules/hardware/thinkpad.nix new file mode 100644 index 0000000..e69de29