this repo has no description
1{
2 description = "Hauleth's configuration";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6 flake-parts.url = "github:hercules-ci/flake-parts";
7
8 home-manager = {
9 url = "github:nix-community/home-manager";
10 inputs.nixpkgs.follows = "nixpkgs";
11 };
12 agnoster = {
13 url = "github:hauleth/agnoster";
14 inputs.nixpkgs.follows = "nixpkgs";
15 };
16 darwin = {
17 url = "github:lnl7/nix-darwin";
18 inputs.nixpkgs.follows = "nixpkgs";
19 };
20
21 lexical = {
22 url = "github:lexical-lsp/lexical";
23 inputs.nixpkgs.follows = "nixpkgs";
24 };
25
26 # nixvim = {
27 # url = "github:nix-community/nixvim";
28 # inputs.nixpkgs.follows = "nixpkgs";
29 # };
30
31 charm-freeze = {
32 url = "github:charmbracelet/freeze";
33 # inputs.nixpkgs.follows = "nixpkgs";
34 };
35 };
36
37 outputs = {
38 self,
39 flake-parts,
40 ...
41 } @ inputs:
42 flake-parts.lib.mkFlake {inherit inputs;} {
43 flake = {
44 lib = {
45 readFileWithComments = path: let
46 lib = inputs.nixpkgs.lib;
47 content = lib.strings.fileContents path;
48 notComment = line: !lib.strings.hasPrefix "#" line;
49 in
50 builtins.filter notComment (lib.strings.splitString "\n" content);
51 };
52
53 # TODO: Automatically discover and build that
54 darwinConfigurations."NiunioBook" =
55 (import ./hosts/niuniobook.nix {inherit inputs;})
56 .system;
57 darwinConfigurations."MacBook-Pro" =
58 (import ./hosts/niuniobook.nix {inherit inputs;})
59 .system;
60
61 homeConfigurations."hauleth" =
62 (import ./users/hauleth.nix {inherit inputs;})
63 .home;
64
65 templates = {
66 elixir = {
67 path = ./templates/elixir;
68 description = "Basic requirements for Elixir applications";
69 };
70 };
71 };
72
73 systems = ["x86_64-darwin" "aarch64-darwin"];
74
75 perSystem = {
76 self',
77 pkgs,
78 inputs',
79 ...
80 }: {
81 formatter = pkgs.alejandra;
82
83 packages =
84 (pkgs.callPackage ./pkgs {})
85 // {
86 default = pkgs.writeScriptBin "activate" ''
87 echo ========= System =========
88 ${pkgs.lib.getExe self'.packages.system} switch
89 echo
90 echo ========= Home =========
91 ${pkgs.lib.getExe self'.packages.home} switch
92 '';
93
94 home = pkgs.writeScriptBin "activate-home" ''
95 ${pkgs.lib.getExe inputs'.home-manager.packages.default} --flake "${self}" "$@"
96 '';
97
98 system = let
99 builder =
100 if pkgs.stdenv.isDarwin
101 then pkgs.lib.getExe' inputs'.darwin.packages.darwin-rebuild "darwin-rebuild"
102 else pkgs.lib.getExe pkgs.nixos-rebuid;
103 in
104 pkgs.writeScriptBin "activate-system" ''
105 ${builder} --flake "${self}" "$@"
106 '';
107 };
108
109 devShells = let
110 globalShells = pkgs.callPackage ./dev_shells.nix {
111 inherit (inputs'.lexical.packages) lexical;
112 };
113 default = pkgs.mkShell {
114 packages = [
115 pkgs.fnlfmt
116 # TODO: Remove it and manage all configuration from Nix
117 pkgs.stow
118 ];
119 };
120 in
121 globalShells // {inherit default;};
122 };
123 };
124}