Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PrivateStorageio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
PrivateStorageio
Commits
38b7d7e8
Commit
38b7d7e8
authored
3 years ago
by
Tom Prince
Browse files
Options
Downloads
Patches
Plain Diff
Make `tools/default.nix` more easily extendable.
parent
156c7f3e
No related branches found
Branches containing commit
No related tags found
2 merge requests
!180
merge develop into production
,
!165
Add a script to update nixos version, and run it.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/default.nix
+24
-9
24 additions, 9 deletions
tools/default.nix
with
24 additions
and
9 deletions
tools/default.nix
+
24
−
9
View file @
38b7d7e8
...
...
@@ -13,22 +13,37 @@ let
echo
${
lib
.
escapeShellArg
./pylib
}
> $out/
${
lib
.
escapeShellArg
python
.
sitePackages
}
/tools.pth
''
;
};
python-commands
=
[
./update-nixpkgs
];
in
# This derivation creates a package that wraps our tools to setup an environment
# with there dependencies available.
# This derivation creates a package that wraps our tools to setup an environment
# with there dependencies available.
pkgs
.
runCommand
"ps_tools"
{
nativeBuildInputs
=
[
makeWrapper
];
shellHook
=
''
# Only display the help if we are running an interactive shell.
if [[ $- == *i* ]]; then
cat <<MOTD
Tools (pass --help for details):
- update-nixpkgs
${
lib
.
concatStringsSep
"
\n
"
(
map
(
path
:
"-
${
baseNameOf
path
}
"
)
python-commands
)
}
MOTD
fi
''
;
}
''
mkdir -p $out/bin
# makeWrapper <executable> <wrapperfile> <args>
# See https://nixos.org/manual/nixpkgs/stable/#fun-makeWrapper
makeWrapper
${
python-env
}
/bin/python $out/bin/update-nixpkgs --add-flags
${
toString
./update-nixpkgs
}
''
}
''
mkdir -p $out/bin
${
lib
.
concatStringsSep
"
\n
"
(
map
(
path
:
let
baseName
=
baseNameOf
path
;
# We use toString so that we wrap the in-tree scripts, rather than copying
# them to the nix-store. This means that we don't need to run nix-shell again
# to pick up changes.
sourcePath
=
toString
path
;
in
# makeWrapper <executable> <wrapperfile> <args>
# See https://nixos.org/manual/nixpkgs/stable/#fun-makeWrapper
"makeWrapper
${
python-env
}
/bin/python $out/bin/
${
baseName
}
--add-flags
${
sourcePath
}
"
)
python-commands
)
}
''
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment