feat: basic flake-parts structure, make-shell, files and readme

This commit is contained in:
Mohammad Rafiq 2025-07-02 23:12:04 +08:00
parent 6c59366f8f
commit a19ede01a2
No known key found for this signature in database
7 changed files with 127 additions and 28 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
test README

88
flake.lock generated
View file

@ -1,8 +1,40 @@
{
"nodes": {
"dedupe_flake-compat": {
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"files": {
"locked": {
"lastModified": 1750263550,
"narHash": "sha256-EW/QJ8i/13GgiynBb6zOMxhLU1uEkRqmzbIDEP23yVA=",
"owner": "mightyiam",
"repo": "files",
"rev": "5f4ef1fd1f9012354a9748be093e277675d10f07",
"type": "github"
},
"original": {
"owner": "mightyiam",
"repo": "files",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1751413152,
@ -18,6 +50,41 @@
"type": "github"
}
},
"import-tree": {
"locked": {
"lastModified": 1751399845,
"narHash": "sha256-iun7//YHeEFgEOcG4KKKoy3d2GWOYqokLFVU/zIs79Y=",
"owner": "vic",
"repo": "import-tree",
"rev": "e24a50ff9b5871d4bdd8900679784812eeb120ea",
"type": "github"
},
"original": {
"owner": "vic",
"repo": "import-tree",
"type": "github"
}
},
"make-shell": {
"inputs": {
"flake-compat": [
"dedupe_flake-compat"
]
},
"locked": {
"lastModified": 1733933815,
"narHash": "sha256-9JjM7eT66W4NJAXpGUsdyAFXhBxFWR2Z9LZwUa7Hli0=",
"owner": "nicknovitski",
"repo": "make-shell",
"rev": "ffeceae9956df03571ea8e96ef77c2924f13a63c",
"type": "github"
},
"original": {
"owner": "nicknovitski",
"repo": "make-shell",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1751271578,
@ -34,24 +101,13 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1751159883,
"narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"dedupe_flake-compat": "dedupe_flake-compat",
"files": "files",
"flake-parts": "flake-parts",
"import-tree": "import-tree",
"make-shell": "make-shell",
"nixpkgs": "nixpkgs"
}
}

View file

@ -3,18 +3,23 @@
# nixos-unstable provides a binary cache for all packages.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# flake-parts lets us define flake modules.
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
# import-tree imports all nix files in a given directory.
import-tree.url = "github:vic/import-tree";
# files lets us write text files and automatically add checks for them
files.url = "github:mightyiam/files";
# make-shells.<name> creates devShells and checks
make-shell = {
url = "github:nicknovitski/make-shell";
inputs.flake-compat.follows = "dedupe_flake-compat";
};
# The following are not used but are here for deduplication.
dedupe_flake-compat.url = "github:edolstra/flake-compat";
};
outputs =
inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.flake-parts.flakeModules.modules ];
systems = [ "x86_64-linux" ];
perSystem =
{ pkgs, ... }:
{
packages.default = pkgs.hello;
};
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
}

21
modules/docs/readme.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, ... }:
{
# text.readme = {
#
# };
perSystem =
{ pkgs, ... }:
{
files.files = [
{
path_ = "README.md";
drv =
pkgs.writeText "README.md" # config.text.readme
''
test README
'';
}
];
};
}

7
modules/meta/files.nix Normal file
View file

@ -0,0 +1,7 @@
{ inputs, ... }:
{
imports = [ inputs.files.flakeModules.default ];
perSystem = psArgs: {
make-shells.default.packages = [ psArgs.config.files.writer.drv ];
};
}

View file

@ -0,0 +1,4 @@
{ inputs, ... }:
{
imports = [ inputs.make-shell.flakeModules.default ];
}

5
modules/systems.nix Normal file
View file

@ -0,0 +1,5 @@
{
systems = [
"x86_64-linux"
];
}