Skip to content

Commit 3c708ea

Browse files
authored
Merge pull request #279 from nix-community/flake/utils
flake: switch to flake-utils and treefmt-nix
2 parents fc832df + cfaf689 commit 3c708ea

File tree

15 files changed

+215
-192
lines changed

15 files changed

+215
-192
lines changed

.github/workflows/format.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
- uses: DeterminateSystems/magic-nix-cache-action@main
1616
- name: Check formatting
1717
run: |
18-
nix fmt -- --check
18+
nix fmt -- --ci

README-template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ is to add the input `github:nix-community/nixpkgs-xr` to your flake
2828
and import the convenient NixOS module `nixpkgs-xr.nixosModules.nixpkgs-xr`.
2929
See the example below.
3030

31-
> [!IMPORTANT]
31+
> \[!IMPORTANT\]
3232
> This module adds the Nixpkgs overlay as well as [the binary cache][binary-cache] for this repository.
3333
> If you don't want the binary cache see [manual setup](#manually-setup-flake-overlay) below.
3434
@@ -84,7 +84,7 @@ Assuming your NixOS configuration is right in your `flake.nix`, you can write th
8484

8585
### Traditional setup
8686

87-
Compatibility for traditional NixOS setups is provided using [flake-compat][flake-compat].
87+
Compatibility for traditional NixOS setups is provided using [flake-compat].
8888
You can just add the following snippet to your configuration:
8989

9090
```nix
@@ -102,7 +102,7 @@ in
102102
}
103103
```
104104

105-
You can also pin the tarball url using tools like [niv][niv].
105+
You can also pin the tarball url using tools like [niv].
106106

107107
## Packages
108108

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ is to add the input `github:nix-community/nixpkgs-xr` to your flake
2828
and import the convenient NixOS module `nixpkgs-xr.nixosModules.nixpkgs-xr`.
2929
See the example below.
3030

31-
> [!IMPORTANT]
31+
> \[!IMPORTANT\]
3232
> This module adds the Nixpkgs overlay as well as [the binary cache][binary-cache] for this repository.
3333
> If you don't want the binary cache see [manual setup](#manually-setup-flake-overlay) below.
3434
@@ -84,7 +84,7 @@ Assuming your NixOS configuration is right in your `flake.nix`, you can write th
8484

8585
### Traditional setup
8686

87-
Compatibility for traditional NixOS setups is provided using [flake-compat][flake-compat].
87+
Compatibility for traditional NixOS setups is provided using [flake-compat].
8888
You can just add the following snippet to your configuration:
8989

9090
```nix
@@ -102,7 +102,7 @@ in
102102
}
103103
```
104104

105-
You can also pin the tarball url using tools like [niv][niv].
105+
You can also pin the tarball url using tools like [niv].
106106

107107
## Packages
108108

development.nix

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: 2024 Sefa Eyeoglu <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
{
5+
flake-utils,
6+
nixpkgs,
7+
self,
8+
treefmt-nix,
9+
...
10+
}:
11+
flake-utils.lib.eachDefaultSystem (
12+
system:
13+
let
14+
pkgs = nixpkgs.legacyPackages.${system};
15+
inherit (pkgs.lib) mapAttrs' nameValuePair;
16+
17+
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
18+
19+
devShellChecks = mapAttrs' (n: nameValuePair "devShell-${n}") self.devShells.${system};
20+
in
21+
{
22+
devShells.default = pkgs.mkShellNoCC {
23+
packages = [
24+
pkgs.nvfetcher
25+
pkgs.reuse
26+
];
27+
};
28+
29+
checks = devShellChecks // {
30+
formatting = treefmtEval.config.build.check self;
31+
};
32+
33+
formatter = treefmtEval.config.build.wrapper;
34+
}
35+
)

flake.lock

Lines changed: 47 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,21 @@
1313

1414
inputs = {
1515
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
16-
flake-parts = {
17-
url = "github:hercules-ci/flake-parts";
18-
inputs.nixpkgs-lib.follows = "nixpkgs";
19-
};
16+
flake-utils.url = "github:numtide/flake-utils";
2017
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
18+
treefmt-nix = {
19+
url = "github:numtide/treefmt-nix";
20+
inputs.nixpkgs.follows = "nixpkgs";
21+
};
2122
};
2223

2324
outputs =
24-
inputs@{ flake-parts, ... }:
25-
flake-parts.lib.mkFlake { inherit inputs; } {
26-
systems = [
27-
"x86_64-linux"
28-
"aarch64-linux"
29-
];
30-
imports = [
31-
./parts/checks.nix
32-
./parts/dev.nix
33-
./parts/module.nix
34-
./parts/readme.nix
35-
./pkgs
36-
];
37-
};
25+
{ flake-utils, ... }@inputs:
26+
flake-utils.lib.meld inputs [
27+
./development.nix
28+
./nixos
29+
./pkgs
30+
./pkgs/overlay.nix
31+
./tools/update-readme.nix
32+
];
3833
}

parts/module.nix renamed to nixos/default.nix

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
# SPDX-FileCopyrightText: 2023 Sefa Eyeoglu <[email protected]>
2+
# SPDX-FileCopyrightText: 2024 Sefa Eyeoglu <[email protected]>
23
#
34
# SPDX-License-Identifier: MIT
45
{ self, ... }:
56
{
6-
flake.nixosModules.nixpkgs-xr =
7+
nixosModules.nixpkgs-xr =
78
{ config, lib, ... }:
89
let
910
inherit (lib)
1011
mkEnableOption
1112
mkIf
1213
mkOption
13-
mkRemovedOptionModule
1414
;
1515
cfg = config.nixpkgs.xr;
1616
in
1717
{
18-
imports = [
19-
(mkRemovedOptionModule [
20-
"nixpkgs"
21-
"xr"
22-
"enableUnstripped"
23-
] "The nixpkgs-xr unstripped overlay has been removed. Please create your own overlay.")
24-
];
25-
2618
options.nixpkgs.xr.enable = mkEnableOption "nixpkgs-xr overlay" // mkOption { default = true; };
2719

2820
config = mkIf cfg.enable {

nvfetcher.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
# SPDX-License-Identifier: CC0-1.0
44

55
[envision-unwrapped]
6-
src.git = "https://gitlab.com/gabmus/envision.git"
6+
cargo_locks = ["Cargo.lock"]
77
fetch.git = "https://gitlab.com/gabmus/envision.git"
8+
src.git = "https://gitlab.com/gabmus/envision.git"
9+
10+
[index_camera_passthrough]
811
cargo_locks = ["Cargo.lock"]
12+
fetch.git = "https://github.com/yshui/index_camera_passthrough.git"
13+
src.git = "https://github.com/yshui/index_camera_passthrough.git"
914

1015
[monado]
11-
src.git = "https://gitlab.freedesktop.org/monado/monado.git"
1216
fetch.git = "https://gitlab.freedesktop.org/monado/monado.git"
17+
src.git = "https://gitlab.freedesktop.org/monado/monado.git"
1318

1419
[opencomposite]
15-
src.git = "https://gitlab.com/znixian/OpenOVR.git"
1620
fetch.git = "https://gitlab.com/znixian/OpenOVR.git"
1721
git.fetchSubmodules = true
18-
19-
[index_camera_passthrough]
20-
src.git = "https://github.com/yshui/index_camera_passthrough.git"
21-
fetch.git = "https://github.com/yshui/index_camera_passthrough.git"
22-
cargo_locks = ["Cargo.lock"]
22+
src.git = "https://gitlab.com/znixian/OpenOVR.git"
2323

2424
[wlx-overlay-s]
25-
src.git = "https://github.com/galister/wlx-overlay-s.git"
26-
fetch.git = "https://github.com/galister/wlx-overlay-s.git"
2725
cargo_locks = ["Cargo.lock"]
26+
fetch.git = "https://github.com/galister/wlx-overlay-s.git"
27+
src.git = "https://github.com/galister/wlx-overlay-s.git"

parts/checks.nix

Lines changed: 0 additions & 21 deletions
This file was deleted.

parts/dev.nix

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)