diff --git a/README.md b/README.md index 9209cdc..4bbc57a 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Dotfiles for NixOS using Flakes. Contains modules and configurations for NixOS, ## Using existing configurations 1. Make sure to have [NixOS](https://nixos.org/manual/nixos/stable/index.html#ch-installation), -[nix-on-droid](https://github.com/nix-community/nix-on-droid#try-it-out) or just -[Nix](https://nixos.org/download#download-nix) properly installed. + [nix-on-droid](https://github.com/nix-community/nix-on-droid#try-it-out) or just + [Nix](https://nixos.org/download#download-nix) properly installed. 2. [Enable Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes_temporarily) if you haven't already. diff --git a/configs/droid/default.nix b/configs/droid/default.nix index ae46731..6a69fda 100644 --- a/configs/droid/default.nix +++ b/configs/droid/default.nix @@ -3,9 +3,7 @@ pkgs, ... }: - -with builtins; -let +with builtins; let hm-config = config.home-manager.config; in { system.stateVersion = "23.11"; diff --git a/flake.lock b/flake.lock index 38fa41f..7f9587d 100644 --- a/flake.lock +++ b/flake.lock @@ -20,31 +20,6 @@ "type": "github" } }, - "alejandra": { - "inputs": { - "fenix": "fenix", - "flakeCompat": [ - "flake-compat" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660592437, - "narHash": "sha256-xFumnivtVwu5fFBOrTxrv6fv3geHKF04RGP23EsDVaI=", - "owner": "kamadorueda", - "repo": "alejandra", - "rev": "e7eac49074b70814b542fee987af2987dd0520b5", - "type": "github" - }, - "original": { - "owner": "kamadorueda", - "ref": "3.0.0", - "repo": "alejandra", - "type": "github" - } - }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -260,28 +235,6 @@ "type": "github" } }, - "fenix": { - "inputs": { - "nixpkgs": [ - "alejandra", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1657607339, - "narHash": "sha256-HaqoAwlbVVZH2n4P3jN2FFPMpVuhxDy1poNOR7kzODc=", - "owner": "nix-community", - "repo": "fenix", - "rev": "b814c83d9e6aa5a28d0cf356ecfdafb2505ad37d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "flake-compat": { "locked": { "lastModified": 1696426674, @@ -721,7 +674,6 @@ "root": { "inputs": { "ags": "ags", - "alejandra": "alejandra", "erosanix": "erosanix", "ez-configs": "ez-configs", "flake-compat": "flake-compat", @@ -731,24 +683,8 @@ "nix-on-droid": "nix-on-droid", "nixpkgs": "nixpkgs", "nixvim": "nixvim", - "stylix": "stylix" - } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1657557289, - "narHash": "sha256-PRW+nUwuqNTRAEa83SfX+7g+g8nQ+2MMbasQ9nt6+UM=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "caf23f29144b371035b864a1017dbc32573ad56d", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" + "stylix": "stylix", + "treefmt-nix": "treefmt-nix" } }, "scss-reset": { @@ -828,6 +764,26 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711531821, + "narHash": "sha256-5n4hq7PsH8g9czJ5HvXpVrJ4AiJdzrutHK01oKIaCXE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "c2172ef83d6904cdff3118e0c08e89171db6028a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 404e78f..45fb02b 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ flake-parts.lib.mkFlake {inherit inputs;} { imports = [ inputs.ez-configs.flakeModule + inputs.treefmt-nix.flakeModule ]; inherit systems; @@ -38,8 +39,14 @@ }; }; - perSystem = {pkgs, ...}: { - formatter = pkgs.alejandra; + perSystem = {...}: { + treefmt.config = { + projectRootFile = "flake.nix"; + programs = { + alejandra.enable = true; + prettier.enable = true; + }; + }; }; flake = { @@ -66,7 +73,7 @@ }; inputs = { - # Loaders + # Systems nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { @@ -80,6 +87,7 @@ inputs.home-manager.follows = "home-manager"; }; + # Flake Framework flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; @@ -91,21 +99,21 @@ inputs.flake-parts.follows = "flake-parts"; }; - # Meta flake-compat.url = "github:edolstra/flake-compat"; - alejandra = { - url = "github:kamadorueda/alejandra/3.0.0"; + # Formatter + treefmt-nix = { + url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.flakeCompat.follows = "flake-compat"; }; + # Scheming stylix = { url = "github:danth/stylix"; inputs.nixpkgs.follows = "nixpkgs"; }; - # Packages + # Programs nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/home/ags/README.md b/modules/home/ags/README.md index ff8ccc5..6d453c5 100644 --- a/modules/home/ags/README.md +++ b/modules/home/ags/README.md @@ -6,7 +6,7 @@ ```bash home-manager switch --flake . -`````` +``` 2. Install type definitions. diff --git a/modules/home/ags/config.js b/modules/home/ags/config.js index 8dc907e..17160a2 100644 --- a/modules/home/ags/config.js +++ b/modules/home/ags/config.js @@ -2,11 +2,17 @@ const entry = `${App.configDir}/src/index.ts`; const main = `/tmp/ags/main.js`; await Utils.execAsync([ - "bun", "build", entry, - "--outfile", main, - "--external", "ressource://*", - "--external", "gi://*", - "--external", "file://*", + "bun", + "build", + entry, + "--outfile", + main, + "--external", + "ressource://*", + "--external", + "gi://*", + "--external", + "file://*", ]).catch(console.error); -await import(`file://${main}`) +await import(`file://${main}`); diff --git a/modules/home/ags/default.nix b/modules/home/ags/default.nix index f6cfebb..f1193a8 100644 --- a/modules/home/ags/default.nix +++ b/modules/home/ags/default.nix @@ -1,28 +1,28 @@ { config, lib, - pkgs, + pkgs, ... }: with lib; let cfg = config.programs.ags; colors = config.lib.stylix.colors; - colorNames = (map (n: "base${fixedWidthNumber 2 n}") (range 0 16)); + colorNames = map (n: "base${fixedWidthNumber 2 n}") (range 0 16); in { config = mkIf cfg.enable { programs.ags = { configDir = ./.; }; - xdg.configFile."ags".recursive = true; + xdg.configFile."ags".recursive = true; xdg.configFile."ags/src/style/colors.css".text = concatMapStringsSep "\n" (color: "@define-color ${color} ${colors.withHashtag.${color}};") - colorNames; + colorNames; - xdg.configFile."ags/src/assets/nixos-symbolic.svg".source = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/35ebbbf01c3119005ed180726c388a01d4d1100c/logo/white.svg"; - hash = "sha256-Ed2l6i2wi/YTcWCq23bspH/t3RYp6AodykpXF1Zgccw="; - }; + xdg.configFile."ags/src/assets/nixos-symbolic.svg".source = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/35ebbbf01c3119005ed180726c388a01d4d1100c/logo/white.svg"; + hash = "sha256-Ed2l6i2wi/YTcWCq23bspH/t3RYp6AodykpXF1Zgccw="; + }; }; } diff --git a/modules/home/ags/package.json b/modules/home/ags/package.json index a1c61b1..44f0f54 100644 --- a/modules/home/ags/package.json +++ b/modules/home/ags/package.json @@ -8,7 +8,7 @@ "peerDependencies": { "typescript": "^5.0.0" }, - "scripts": { - "postinstall": "rm types; ln -s $HOME/.local/share/com.github.Aylur.ags/types types" - } + "scripts": { + "postinstall": "rm types; ln -s $HOME/.local/share/com.github.Aylur.ags/types types" + } } diff --git a/modules/home/ags/src/index.ts b/modules/home/ags/src/index.ts index dfd7406..6b24baa 100644 --- a/modules/home/ags/src/index.ts +++ b/modules/home/ags/src/index.ts @@ -2,6 +2,6 @@ import Bar from "./widget/Bar"; App.addIcons(`${App.configDir}/src/assets`); App.config({ - windows: [Bar(0)], - style: `${App.configDir}/src/style/global.css`, + windows: [Bar(0)], + style: `${App.configDir}/src/style/global.css`, }); diff --git a/modules/home/ags/src/widget/Bar/index.ts b/modules/home/ags/src/widget/Bar/index.ts index b4fa18c..dc8b773 100644 --- a/modules/home/ags/src/widget/Bar/index.ts +++ b/modules/home/ags/src/widget/Bar/index.ts @@ -1,22 +1,26 @@ -export default (monitor = 0) => Widget.Window({ - monitor, - name: `bar-${monitor}`, - anchor: ["top", "left", "right"], - exclusivity: "exclusive", - child: Widget.CenterBox({ - startWidget: Widget.Box({ - hexpand: true, - hpack: "start", - child: Widget.Icon("nixos-symbolic"), - }), - centerWidget: Widget.Box({ - hpack: "center", - child: Widget.Label().poll(1000, self => self.label = Utils.exec("date")), - }), - endWidget: Widget.Box({ - hexpand: true, - hpack: "end", - child: Widget.Icon("nixos-symbolic"), - }), - }), -}); +export default (monitor = 0) => + Widget.Window({ + monitor, + name: `bar-${monitor}`, + anchor: ["top", "left", "right"], + exclusivity: "exclusive", + child: Widget.CenterBox({ + startWidget: Widget.Box({ + hexpand: true, + hpack: "start", + child: Widget.Icon("nixos-symbolic"), + }), + centerWidget: Widget.Box({ + hpack: "center", + child: Widget.Label().poll( + 1000, + (self) => (self.label = Utils.exec("date")), + ), + }), + endWidget: Widget.Box({ + hexpand: true, + hpack: "end", + child: Widget.Icon("nixos-symbolic"), + }), + }), + }); diff --git a/modules/home/ags/tsconfig.json b/modules/home/ags/tsconfig.json index 84a1e14..fbef07d 100644 --- a/modules/home/ags/tsconfig.json +++ b/modules/home/ags/tsconfig.json @@ -7,7 +7,7 @@ "moduleDetection": "force", "jsx": "react-jsx", "allowJs": true, - "checkJs": true, + "checkJs": true, // Bundler mode "moduleResolution": "bundler",